Example #1
0
 def create_network(self, tenant_id, net_name, **kwargs):
     net = db.network_create(tenant_id, net_name,
                             op_status=OperationalStatus.UP)
     LOG.debug("Created network: %s" % net)
     vlan_id = self.vmap.acquire(str(net.uuid))
     ovs_db.add_vlan_binding(vlan_id, str(net.uuid))
     return self._make_net_dict(str(net.uuid), net.name, [], net.op_status)
Example #2
0
def TestRuijieVlanSetting():
    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(100, "network_id")
    ruijie_vlan.set_ruijie_vlan("intf_id", "network_id")
    binding = ruijie_db.get_ruijie_vlan_binding("192.168.21.35", "GigabitEthernet 3/0/20", 100)
    if binding == []:
        assert 0
Example #3
0
    def create_network(self, tenant_id, net_name, **kwargs):
        net = db.network_create(tenant_id,
                                net_name,
                                op_status=OperationalStatus.UP)
        try:
            vlan_id = self.vmap.acquire(str(net.uuid))
        except NoFreeVLANException:
            db.network_destroy(net.uuid)
            raise

        LOG.debug("Created network: %s" % net)
        ovs_db.add_vlan_binding(vlan_id, str(net.uuid))
        return self._make_net_dict(str(net.uuid), net.name, [], net.op_status)
Example #4
0
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