Пример #1
0
def configure_second_admin_cobbler(self):
    dhcp_template = '/etc/cobbler/dnsmasq.template'
    remote = self.d_env.get_admin_remote()
    admin_net2 = self.d_env.admin_net2
    second_admin_if = settings.INTERFACES.get(admin_net2)
    second_admin_ip = str(
        self.d_env.nodes().admin.get_ip_address_by_network_name(admin_net2))

    admin_net2_object = self.d_env.get_network(name=admin_net2)
    second_admin_network = admin_net2_object.ip.ip
    second_admin_netmask = admin_net2_object.ip.netmask
    network = IPNetwork('{0}/{1}'.format(second_admin_network,
                                         second_admin_netmask))
    discovery_subnet = [net for net in network.iter_subnets(1)][-1]
    first_discovery_address = str(discovery_subnet.network)
    last_discovery_address = str(discovery_subnet.broadcast - 1)
    new_range = ('interface={4}\\n'
                 'dhcp-range=internal2,{0},{1},{2}\\n'
                 'dhcp-option=net:internal2,option:router,{3}\\n'
                 'pxe-service=net:internal2,x86PC,"Install",pxelinux,{3}\\n'
                 'dhcp-boot=net:internal2,pxelinux.0,boothost,{3}\\n').\
        format(first_discovery_address, last_discovery_address,
               second_admin_netmask, second_admin_ip, second_admin_if)
    cmd = ("dockerctl shell cobbler sed -r '$a \{0}' -i {1};"
           "dockerctl shell cobbler cobbler sync").format(new_range,
                                                          dhcp_template)
    result = remote.execute(cmd)
    assert_equal(result['exit_code'], 0, ('Failed to add second admin'
                 'network to cobbler: {0}').format(result))
def configure_second_admin_cobbler(self):
    dhcp_template = '/etc/cobbler/dnsmasq.template'
    remote = self.get_admin_remote()
    main_admin_ip = str(self.nodes().admin.
                        get_ip_address_by_network_name(self.admin_net))
    second_admin_ip = str(self.nodes().admin.
                          get_ip_address_by_network_name(self.admin_net2))
    second_admin_network = self.get_network(self.admin_net2).split('/')[0]
    second_admin_netmask = self.get_net_mask(self.admin_net2)
    network = IPNetwork('{0}/{1}'.format(second_admin_network,
                                         second_admin_netmask))
    discovery_subnet = [net for net in network.iter_subnets(1)][-1]
    first_discovery_address = str(discovery_subnet.network)
    last_discovery_address = str(discovery_subnet.broadcast - 1)
    new_range = ('dhcp-range=internal2,{0},{1},{2}\\n'
                 'dhcp-option=net:internal2,option:router,{3}\\n'
                 'dhcp-boot=net:internal2,pxelinux.0,boothost,{4}\\n').\
        format(first_discovery_address, last_discovery_address,
               second_admin_netmask, second_admin_ip, main_admin_ip)
    cmd = ("dockerctl shell cobbler sed -r '$a \{0}' -i {1};"
           "dockerctl shell cobbler cobbler sync").format(new_range,
                                                          dhcp_template)
    result = remote.execute(cmd)
    assert_equal(result['exit_code'], 0, ('Failed to add second admin'
                 'network to cobbler: {0}').format(result))
def configure_second_admin_cobbler(self):
    dhcp_template = '/etc/cobbler/dnsmasq.template'
    remote = self.get_admin_remote()
    main_admin_ip = str(self.nodes().admin.get_ip_address_by_network_name(
        self.admin_net))
    second_admin_ip = str(self.nodes().admin.get_ip_address_by_network_name(
        self.admin_net2))
    second_admin_network = self.get_network(self.admin_net2).split('/')[0]
    second_admin_netmask = self.get_net_mask(self.admin_net2)
    network = IPNetwork('{0}/{1}'.format(second_admin_network,
                                         second_admin_netmask))
    discovery_subnet = [net for net in network.iter_subnets(1)][-1]
    first_discovery_address = str(discovery_subnet.network)
    last_discovery_address = str(discovery_subnet.broadcast - 1)
    new_range = ('dhcp-range=internal2,{0},{1},{2}\\n'
                 'dhcp-option=net:internal2,option:router,{3}\\n'
                 'dhcp-boot=net:internal2,pxelinux.0,boothost,{4}\\n').\
        format(first_discovery_address, last_discovery_address,
               second_admin_netmask, second_admin_ip, main_admin_ip)
    cmd = ("dockerctl shell cobbler sed -r '$a \{0}' -i {1};"
           "dockerctl shell cobbler cobbler sync").format(
               new_range, dhcp_template)
    result = remote.execute(cmd)
    assert_equal(result['exit_code'], 0,
                 ('Failed to add second admin'
                  'network to cobbler: {0}').format(result))
Пример #4
0
def configure_second_admin_cobbler(self):
    dhcp_template = '/etc/cobbler/dnsmasq.template'
    admin_net2 = self.d_env.admin_net2
    second_admin_if = settings.INTERFACES.get(admin_net2)
    second_admin_ip = str(
        self.d_env.nodes().admin.get_ip_address_by_network_name(admin_net2))

    admin_net2_object = self.d_env.get_network(name=admin_net2)
    second_admin_network = admin_net2_object.ip.ip
    second_admin_netmask = admin_net2_object.ip.netmask
    network = IPNetwork('{0}/{1}'.format(second_admin_network,
                                         second_admin_netmask))
    discovery_subnet = [net for net in network.iter_subnets(1)][-1]
    first_discovery_address = str(discovery_subnet.network)
    last_discovery_address = str(discovery_subnet.broadcast - 1)
    new_range = ('interface={4}\\n'
                 'dhcp-range=internal2,{0},{1},{2}\\n'
                 'dhcp-option=net:internal2,option:router,{3}\\n'
                 'pxe-service=net:internal2,x86PC,"Install",pxelinux,{3}\\n'
                 'dhcp-boot=net:internal2,pxelinux.0,boothost,{3}\\n').\
        format(first_discovery_address, last_discovery_address,
               second_admin_netmask, second_admin_ip, second_admin_if)
    cmd = ("dockerctl shell cobbler sed -r '$a \{0}' -i {1};"
           "dockerctl shell cobbler cobbler sync").format(
               new_range, dhcp_template)
    with self.d_env.get_admin_remote() as remote:
        result = remote.execute(cmd)
    assert_equal(result['exit_code'], 0,
                 ('Failed to add second admin'
                  'network to cobbler: {0}').format(result))