def test_list_ports(self): try: # Pre-populate data for testing using db api net = db.network_create(self.tenant_id, self.network_name_1) network_id = net['uuid'] db.port_create(network_id) db.port_create(network_id) cli.list_ports(self.client, self.tenant_id, network_id) except: LOG.exception("Exception caught: %s", sys.exc_info()) self.fail("test_list_ports failed due to an exception") LOG.debug("Operation completed. Verifying result") LOG.debug(self.fake_stdout.content) self._verify_list_ports(network_id)
def create_port(self, tenant_id, net_id, port_state=None, **kwargs): LOG.debug("Creating port with network_id: %s" % net_id) db.validate_network_ownership(tenant_id, net_id) port = db.port_create(net_id, port_state, op_status=OperationalStatus.DOWN) return self._make_port_dict(port)
def _create_target(self): tenant_id = "tenant1" net_name = "network1" self.vif_id = "vif1" net = db.network_create(tenant_id, net_name) self.port = db.port_create(net.uuid) db.port_set_attachment(self.port.uuid, net.uuid, self.vif_id)
def create_port(self, tenant_id, net_id, port_state=None, **kwargs): """ Creates a port on the specified Virtual Network. """ LOG.debug("FakePlugin.create_port() called") # verify net_id self._get_network(tenant_id, net_id) port = db.port_create(net_id, port_state) port_item = {'port-id': str(port.uuid)} return port_item
def create_port(self, tenant_id, net_id, port_state=None, **kwargs): """ Creates a port on the specified Virtual Network. """ LOG.debug("LinuxBridgePlugin.create_port() called") port = db.port_create(net_id, port_state, op_status=OperationalStatus.DOWN) unique_port_id_string = port[const.UUID] new_port_dict = cutil.make_port_dict(port) return new_port_dict
def create_port(self, tenant_id, net_id, port_state=None, **kwargs): """ Creates a port on the specified Virtual Network. """ LOG.debug("LinuxBridgePlugin.create_port() called") db.validate_network_ownership(tenant_id, net_id) port = db.port_create(net_id, port_state, op_status=OperationalStatus.DOWN) new_port_dict = cutil.make_port_dict(port) return new_port_dict
def create_port(self, tenant_id, net_id, port_state=None, **kwargs): """ Creates a port on the specified Virtual Network. """ LOG.debug("FakePlugin.create_port() called") # verify net_id self._get_network(tenant_id, net_id) port = db.port_create(net_id, port_state) # Put operational status UP db.port_update(port.uuid, net_id, op_status=OperationalStatus.UP) port_item = {'port-id': str(port.uuid)} return port_item
def test_show_network_details(self): iface_id = "flavor crystals" try: # Load some data into the datbase net = db.network_create(self.tenant_id, self.network_name_1) network_id = net['uuid'] port = db.port_create(network_id) port_id = port['uuid'] db.port_set_attachment(port_id, network_id, iface_id) port = db.port_create(network_id) cli.show_net_detail(self.client, self.tenant_id, network_id, self.version) except: LOG.exception("Exception caught: %s", sys.exc_info()) self.fail("test_show_network_details failed due to an exception") LOG.debug("Operation completed. Verifying result") LOG.debug(self.fake_stdout.content) self._verify_show_network_details()
def create_port(self, net_id): """Add a port.""" port_dict = {} try: port = db.port_create(net_id) LOG.debug("Creating port %s", port.uuid) port_dict["id"] = str(port.uuid) port_dict["net-id"] = str(port.network_id) port_dict["attachment"] = port.interface_id port_dict["state"] = port.state return port_dict except Exception as exc: LOG.error("Failed to create port: %s", str(exc))
def create_port(self, net_id): """Add a port""" port_dict = {} try: port = db.port_create(net_id) LOG.debug("Creating port %s" % port.uuid) port_dict["port-id"] = str(port.uuid) port_dict["net-id"] = str(port.network_id) port_dict["int-id"] = port.interface_id port_dict["state"] = port.state return port_dict except Exception, exc: LOG.error("Failed to create port: %s" % str(exc))
def create_port(self, tenant_id, network_id, port_state=None): """ Creates a port on the specified Virtual Network. """ LOG.debug("create_port() called") # verify network_id self._get_network(tenant_id, network_id) port_state_up = None if port_state: self._validate_port_state(port_state) port_state_up = port_state.upper() port = db.port_create(network_id, port_state_up) LOG.debug("create_port(): port state is %s" % port.state) return {'port-id': port.uuid}
def test_update_port(self): try: net = db.network_create(self.tenant_id, self.network_name_1) network_id = net['uuid'] port = db.port_create(network_id) port_id = port['uuid'] # Default state is DOWN - change to ACTIVE. cli.update_port(self.client, self.tenant_id, network_id, port_id, 'state=ACTIVE') except: LOG.exception("Exception caught: %s", sys.exc_info()) self.fail("test_update_port failed due to an exception") LOG.debug("Operation completed. Verifying result") LOG.debug(self.fake_stdout.content) self._verify_update_port(network_id, port_id)
def test_show_port_no_attach(self): network_id = None port_id = None try: # Pre-populate data for testing using db api net = db.network_create(self.tenant_id, self.network_name_1) network_id = net['uuid'] port = db.port_create(network_id) port_id = port['uuid'] cli.show_port(self.client, self.tenant_id, network_id, port_id) except: LOG.exception("Exception caught: %s", sys.exc_info()) self.fail("test_show_port_no_attach failed due to an exception") LOG.debug("Operation completed. Verifying result") LOG.debug(self.fake_stdout.content) self._verify_show_port(network_id, port_id)
def TestRuijieVlanUnsetting(): db.clear_db() net = db.network_create("miaosf", "net1") port = db.port_create(net.uuid) db.port_set_attachment(port.uuid, net.uuid, "intf_id") ruijie_db.add_ruijie_switch_eth_binding("192.168.21.35", "0050.56bc.0003", "GigabitEthernet 3/0/20"); ruijie_db.add_ruijie_vm_eth_binding("intf_id", "0050.56bc.0003"); ovs_db.add_vlan_binding(200, net.uuid) ruijie_vlan.set_ruijie_vlan("intf_id", net.uuid) binding = ruijie_db.get_ruijie_vlan_binding("192.168.21.35", "GigabitEthernet 3/0/20", 200) if binding == []: assert 0 ruijie_vlan.unset_ruijie_vlan(net.uuid, port.uuid) binding = ruijie_db.get_ruijie_vlan_binding("192.168.21.35", "GigabitEthernet 3/0/20", 200) if binding != []: assert 0
def test_unplug_iface(self): network_id = None port_id = None try: # Load some data into the datbase net = db.network_create(self.tenant_id, self.network_name_1) network_id = net['uuid'] port = db.port_create(net['uuid']) port_id = port['uuid'] db.port_set_attachment(port_id, network_id, "test_iface_id") cli.unplug_iface(self.client, self.tenant_id, network_id, port_id) except: LOG.exception("Exception caught: %s", sys.exc_info()) self.fail("test_plug_iface failed due to an exception") LOG.debug("Operation completed. Verifying result") LOG.debug(self.fake_stdout.content) self._verify_unplug_iface(network_id, port_id)
def create_port(self, tenant_id, net_id, port_state=None, **kwargs): """ Creates a port on the specified Virtual Network. :returns: a mapping sequence with the following signature: {'port-id': uuid representing the created port on specified quantum network } :raises: exception.NetworkNotFound :raises: exception.StateInvalid """ LOG.debug("QuantumRestProxy: create_port() called") self.get_network(tenant_id, net_id) # Update DB port = db.port_create(net_id, port_state, op_status=OperationalStatus.DOWN) port_id = str(port.uuid) # create on networl ctrl try: resource = '/tenants/%s/networks/%s/ports' % ( tenant_id, net_id) data = { "port": { "id": port_id, "state": port_state, } } ret = self.servers.post(resource, data) if not self.servers.action_success(ret): raise RemoteRestError(ret[2]) except RemoteRestError as e: LOG.error( 'QuantumRestProxy: Unable to create remote port: %s' % e.message) db.port_destroy(port_id, net_id) raise return self.make_port_dict(port)
def create_port(self, tenant_id, net_id, port_state=None, **kwargs): LOG.debug("PRUTH: Creating port with network_id: %s" % net_id) neuca_tenant_id = self.config.get("NEUCA", "neuca_tenant_id") if tenant_id != neuca_tenant_id: db.validate_network_ownership(tenant_id, net_id) #new_mac = None #else: #new_mac = str(quantum.common.utils.generate_mac()) # pass port = db.port_create(net_id, port_state, op_status=OperationalStatus.DOWN) LOG.debug("PRUTH: neuca_tenant_id: %s, net_id: %s, interface_id: %s" % (neuca_tenant_id, net_id, port.interface_id)) LOG.debug("PRUTH: kwargs:%s" % (str(kwargs))) neuca_db.add_port_properties(port.uuid,None,None) return self._make_port_dict(port)
def test_show_iface_with_attach(self): network_id = None port_id = None iface_id = "flavor crystals" try: # Pre-populate data for testing using db api net = db.network_create(self.tenant_id, self.network_name_1) network_id = net['uuid'] port = db.port_create(network_id) port_id = port['uuid'] db.port_set_attachment(port_id, network_id, iface_id) cli.show_iface(self.client, self.tenant_id, network_id, port_id, self.version) except: LOG.exception("Exception caught: %s", sys.exc_info()) self.fail("test_show_iface_with_attach failed due" + " to an exception") LOG.debug("Operation completed. Verifying result") LOG.debug(self.fake_stdout.content) self._verify_show_iface(network_id, port_id)
def create_port(self, tenant_id, net_id, port_state=None): LOG.debug("Creating port with network_id: %s" % net_id) port = db.port_create(net_id, port_state) return self._make_port_dict(str(port.uuid), port.state, port.network_id, port.interface_id)