client/cli/api development
"""
- #static data for networks and ports
- _port_dict_1 = {
- 1: {'port-id': 1,
- 'port-state': 'DOWN',
- 'attachment': None},
- 2: {'port-id': 2,
- 'port-state': 'UP',
- 'attachment': None}}
- _port_dict_2 = {
- 1: {'port-id': 1,
- 'port-state': 'UP',
- 'attachment': 'SomeFormOfVIFID'},
- 2: {'port-id': 2,
- 'port-state': 'DOWN',
- 'attachment': None}}
- _networks = {'001':
- {
- 'net-id': '001',
- 'net-name': 'pippotest',
- 'net-ports': _port_dict_1},
- '002':
- {
- 'net-id': '002',
- 'net-name': 'cicciotest',
- 'net-ports': _port_dict_2}}
-
def __init__(self):
- db.configure_db({'sql_connection':'sqlite:///:memory:'})
- FakePlugin._net_counter = len(FakePlugin._networks)
++ db.configure_db({'sql_connection': 'sqlite:///:memory:'})
+ FakePlugin._net_counter = 0
def _get_network(self, tenant_id, network_id):
- network = FakePlugin._networks.get(network_id)
- if not network:
+ try:
+ network = db.network_get(network_id)
+ except:
raise exc.NetworkNotFound(net_id=network_id)
return network