monkey/monkey_business/cc/connectors/demo.py

37 lines
819 B
Python
Raw Normal View History

2016-05-29 16:45:07 +08:00
from connectors import NetControllerConnector
demo_state = {
501: ["Machine A", "Machine B"],
502: ["Machine C",],
503: ["Machine D",],
514: ["Machine E", "Machine F"],
}
class DemoConnector(NetControllerConnector):
def __init__(self):
self._conn = None
self._properties = {
"address": "127.0.0.1",
"port": 0,
"username": "",
"password": "",
}
def connect(self):
self._conn = object()
def is_connected(self):
return not self._conn == None
def disconnect(self):
self._conn = None
def get_vlans_list(self):
return demo_state.keys()
def get_entities_on_vlan(self, vlanid):
if (demo_state.has_key(vlanid)):
return demo_state[vlanid]
return []