Exemplo n.º 1
0
 def test_node_creation(self):
     environment = Environment.create('test_env3')
     internal = Network.network_create(
         environment=environment, name='internal', pool=None)
     node = Node.node_create(name='test_node', environment=environment)
     Interface.interface_create(node=node, network=internal)
     environment.define()
Exemplo n.º 2
0
 def test_network_model(self):
     environment = Environment.create('test_env')
     node = Node.node_create('test_node', environment)
     network = Network.network_create(
         environment=environment, name='internal', ip_network='10.1.0.0/24')
     interface1 = Interface.interface_create(network=network, node=node)
     self.assertEquals('virtio', interface1.model)
     interface2 = Interface.interface_create(
         network=network, node=node, model='e1000')
     self.assertEquals('e1000', interface2.model)
Exemplo n.º 3
0
    def test_node_creation(self):
        environment = Environment.create('test_env3')
        pool = IpNetworksPool(networks=[IPNetwork('10.1.0.0/24')], prefix=24)
        address_pool = AddressPool.address_pool_create(
            environment=environment, name='internal', pool=pool)
        l2_net_dev = L2NetworkDevice.objects.create(
            group=None, address_pool=address_pool, name='test_l2_dev')

        node = Node.objects.create(
            group=None,
            name='test_node',
            role='default',
        )
        Interface.interface_create(l2_network_device=l2_net_dev,
                                   node=node, label='eth0')
        environment.define()
Exemplo n.º 4
0
 def test_network_iterator(self):
     environment = Environment.create('test_env')
     node = Node.node_create('test_node', environment)
     network = Network.network_create(
         environment=environment, name='internal', ip_network='10.1.0.0/24')
     interface = Interface.interface_create(network=network, node=node)
     Address.objects.create(str('10.1.0.1'), interface=interface)
     network.next_ip()
     Address.objects.create(str('10.1.0.3'), interface=interface)
     ip = network.next_ip()
     self.assertEquals('10.1.0.4', str(ip))
Exemplo n.º 5
0
    def test_network_model(self):
        environment = Environment.create('test_env')
        node = Node.objects.create(
            group=None,
            name='test_node',
            role='default',
        )
        pool = IpNetworksPool(networks=[IPNetwork('10.1.0.0/24')], prefix=24)
        address_pool = AddressPool.address_pool_create(
            environment=environment, name='internal', pool=pool)
        l2_net_dev = L2NetworkDevice.objects.create(
            group=None, address_pool=address_pool, name='test_l2_dev')

        interface1 = Interface.interface_create(l2_network_device=l2_net_dev,
                                                node=node, label='eth0')

        assert interface1.model == 'virtio'
        interface2 = Interface.interface_create(l2_network_device=l2_net_dev,
                                                node=node, label='eth0',
                                                model='e1000')
        assert interface2.model == 'e1000'
Exemplo n.º 6
0
 def test_network_iterator(self):
     environment = Environment.create('test_env')
     node = Node.objects.create(
         group=None,
         name='test_node',
         role='default',
     )
     pool = IpNetworksPool(networks=[IPNetwork('10.1.0.0/24')], prefix=24)
     address_pool = AddressPool.address_pool_create(
         environment=environment, name='internal', pool=pool)
     l2_net_dev = L2NetworkDevice.objects.create(
         group=None, address_pool=address_pool, name='test_l2_dev')
     interface = Interface.interface_create(l2_network_device=l2_net_dev,
                                            node=node, label='eth0')
     assert str(address_pool.next_ip()) == '10.1.0.3'
     Address.objects.create(ip_address=str('10.1.0.3'),
                            interface=interface)
     assert str(address_pool.next_ip()) == '10.1.0.4'
     Address.objects.create(ip_address=str('10.1.0.4'),
                            interface=interface)
     assert str(address_pool.next_ip()) == '10.1.0.5'
Exemplo n.º 7
0
def one():
    environment = Environment.create('cdrom')
    internal_pool = Network.create_network_pool(
        networks=[IPNetwork('10.108.0.0/16')], prefix=24
    )
    private_pool = Network.create_network_pool(
        networks=[IPNetwork('10.108.0.0/16')], prefix=24
    )
    external_pool = Network.create_network_pool(
        networks=[IPNetwork('172.18.95.0/24')], prefix=27
    )
    internal = Network.network_create(
        environment=environment, name='internal', pool=internal_pool)
    external = Network.network_create(
        environment=environment, name='external', pool=external_pool,
        forward='nat')
    private = Network.network_create(
        environment=environment, name='private', pool=private_pool)
    for i in range(1, 2):
        node = Node.node_create(
            name='test_node' + str(i), environment=environment)
        Interface.interface_create(node=node, network=internal)
        Interface.interface_create(node=node, network=external)
        Interface.interface_create(node=node, network=private)
        volume = Volume.volume_get_predefined(
            '/var/lib/libvirt/images/centos63-cobbler-base.qcow2')
        v3 = Volume.volume_create_child(
            'test_vp895' + str(i), backing_store=volume,
            environment=environment)
        v4 = Volume.volume_create_child(
            'test_vp896' + str(i), backing_store=volume,
            environment=environment)
        DiskDevice.node_attach_volume(node=node, volume=v3)
        DiskDevice.node_attach_volume(node, v4)
        DiskDevice.node_attach_volume(
            node,
            Volume.volume_get_predefined(
                '/var/lib/libvirt/images/fuel-centos-6.3-x86_64.iso'),
            device='cdrom', bus='sata')
    environment.define()
    environment.start()
    remotes = []
    for node in environment.get_nodes():
        node.await('internal')
        node.remote('internal', 'root', 'r00tme').check_stderr(
            'ls -la', verbose=True)
        remotes.append(node.remote('internal', 'root', 'r00tme'))
    SSHClient.execute_together(remotes, 'ls -la')
Exemplo n.º 8
0
 def test_create_node3(self):
     environment = Environment.create('test_env3')
     internal = Network.network_create(
         environment=environment, name='internal', pool=None)
     external = Network.network_create(
         environment=environment, name='external', pool=None)
     private = Network.network_create(
         environment=environment, name='private', pool=None)
     node = Node.node_create(name='test_node', environment=environment)
     Interface.interface_create(node=node, network=internal)
     Interface.interface_create(node=node, network=external)
     Interface.interface_create(node=node, network=private)
     volume = Volume.volume_get_predefined(
         '/var/lib/libvirt/images/disk-135824657433.qcow2')
     v3 = Volume.volume_create_child(
         'test_vp892', backing_store=volume, environment=environment)
     v4 = Volume.volume_create_child(
         'test_vp891', backing_store=volume, environment=environment)
     DiskDevice.node_attach_volume(node=node, volume=v3)
     DiskDevice.node_attach_volume(node, v4)
     environment.define()