mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 02:38:03 +00:00 
			
		
		
		
	example fetching and removing connections
Signed-off-by: Jed Reynolds <jed@bitratchet.com>
This commit is contained in:
		
							
								
								
									
										36
									
								
								py-scripts/sandbox/example-connection-removal.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								py-scripts/sandbox/example-connection-removal.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| #!/usr/bin/env python3 | ||||
|  | ||||
| import sys | ||||
| import os | ||||
| import importlib | ||||
| from pprint import pprint #, pformat | ||||
|  | ||||
|  | ||||
| path_hunks = os.path.abspath(__file__).split('/') | ||||
| while( path_hunks[-1] != 'lanforge-scripts'): | ||||
|     path_hunks.pop() | ||||
| sys.path.append(os.path.join("/".join(path_hunks))) | ||||
| realm = importlib.import_module("py-json.realm") | ||||
| Realm = realm.Realm | ||||
|  | ||||
| class eggsample(Realm): | ||||
|     def __init__(self): | ||||
|         super().__init__("ct521a-lion", 8080); | ||||
|  | ||||
|     def run(self): | ||||
|         layer3_result = self.cx_list() # this is realm::cx_list() | ||||
|         pprint(("layer3 result records:", layer3_result)) | ||||
|         layer3_names = [ item["name"] for item in layer3_result.values() if "_links" in item] | ||||
|         pprint(("layer3 names:", layer3_names)) | ||||
|         #LFUtils.remove_cx(self.url, layer3_names) | ||||
|  | ||||
|  | ||||
| def main(): | ||||
|     egg = eggsample() | ||||
|     egg.run() | ||||
|  | ||||
|  | ||||
| if __name__ == "__main__": | ||||
|     main() | ||||
| # | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jed Reynolds
					Jed Reynolds