testing connection to posiedon
import cmd
+from poseidon.main import SDNConnect
+
class Commands:
@@ -15,16 +17,6 @@ class Commands:
''' collect on a specific thing '''
return
- def show_active(self, args):
- ''' show all devices that are currently active '''
- return
-
- def show_inactive(self, args):
- '''
- show all devices that are currently inactive but once were active
- '''
- return
-
def clear_inactives(self, args):
''' clear out all inactive devices '''
return
@@ -47,10 +39,17 @@ class Commands:
def show_state(self, args):
''' show all devices that are in a specific state '''
- return
+ endpoints = []
+ sdnc = SDNConnect()
+ sdnc.get_stored_endpoints()
+ for endpoint in sdnc.endpoints:
+ # TODO parse out args instead of hardcoding inactive
+ if endpoint.state != 'inactive':
+ endpoints.append(endpoint)
+ return endpoints
def show_devices(self, args):
- ''' show all devices that are of a specific filter'''
+ ''' show all devices that are of a specific filter. i.e. windows, dev workstation, etc.'''
return
@@ -106,6 +105,16 @@ class PoseidonShell(cmd.Cmd):
'''
Commands().collect_on(arg)
+ def do_show(self, arg):
+ '''
+ Show things on the network based on filters:
+ SHOW ACTIVE DEVICES
+ SHOW INACTIVE DEVICES
+ '''
+ # TODO check if it should call show_state or show_devices
+ endpoints = Commands().show_state(arg)
+ print(endpoints)
+
def do_quit(self, arg):
'Stop recording and exit: QUIT'
print('Thank you for using Poseidon')
