def get_network(self, context, id, fields=None, verbose=None): """ might be a change in last two statements """ # (harspras) Just return from _networks dict network = qdb._get_network(context, id) vlan = cdb.get_vlan_binding(id) return {const.ID: id, const.NAME: network.name, const.NET_PORTS: network.ports, const.NET_VLAN_NAME: vlan.vlan_name, const.NET_VLAN_ID: vlan.vlan_id}
def update_network(self, context, id, network): """ Updates the properties of a particular Virtual Network. """ n = network['network'] LOG.debug("CatalystPlugin:update_network() called\n") with context.session.begin(): network = qdb._get_network(context, id) network.update(n) return qdb._make_network_dict(network)
def delete_network(self, context, tenant_id, id): """ Deletes a VLAN in the switch, and removes the VLAN configuration from the relevant interfaces """ LOG.debug("CatalystPlugin:delete_network() called\n") vlan_id = self._get_vlan_id_for_network(tenant_id, id) ports_id = ctst_db.get_catalystport_binding(vlan_id) LOG.debug("CatalystPlugin:Interfaces to be disassociated: %s" % ports_id) ctst_db.remove_catalystport_binding(vlan_id) # (harspras) Add exception for Network not found net = qdb._get_network(context, id) self._client.delete_vlan(str(vlan_id)) return net