Commit 41f19d1c authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Revert "format: Support environments with netmask with /"

This reverts commit 18ee7dad

/reviewed-on !107
parent cdee9d29
...@@ -1212,11 +1212,6 @@ class Interface(object): ...@@ -1212,11 +1212,6 @@ class Interface(object):
raise AddressGenerationError(addr) raise AddressGenerationError(addr)
netmask = ipv6FromBin('1'*128) # the netmask of the tap itself is always 128 bits netmask = ipv6FromBin('1'*128) # the netmask of the tap itself is always 128 bits
if '/' in netmask:
_addr_netmask, _ = netmask.split('/')
else:
_addr_netmask = netmask
while try_num > 0: while try_num > 0:
if tap: if tap:
addr = ipv6FromBin(prefix addr = ipv6FromBin(prefix
...@@ -1226,11 +1221,11 @@ class Interface(object): ...@@ -1226,11 +1221,11 @@ class Interface(object):
addr = ':'.join(address_dict['addr'].split(':')[:-1] + ['%x' % ( addr = ':'.join(address_dict['addr'].split(':')[:-1] + ['%x' % (
random.randint(1, 65000), )]) random.randint(1, 65000), )])
socket.inet_pton(socket.AF_INET6, addr) socket.inet_pton(socket.AF_INET6, addr)
if (dict(addr=addr, netmask=_addr_netmask) not in if (dict(addr=addr, netmask=netmask) not in
self.getGlobalScopeAddressList(tap=tap)): self.getGlobalScopeAddressList(tap=tap)):
# Checking the validity of the IPv6 address # Checking the validity of the IPv6 address
if self._addSystemAddress(addr, _addr_netmask, tap=tap): if self._addSystemAddress(addr, netmask, tap=tap):
return dict(addr=addr, netmask=_addr_netmask) return dict(addr=addr, netmask=netmask)
try_num -= 1 try_num -= 1
raise AddressGenerationError(addr) raise AddressGenerationError(addr)
......
...@@ -471,11 +471,11 @@ class TestComputer(SlapformatMixin): ...@@ -471,11 +471,11 @@ class TestComputer(SlapformatMixin):
INTERFACE_DICT['myinterface'] = { INTERFACE_DICT['myinterface'] = {
socket.AF_INET: [{'addr': '192.168.242.77', 'broadcast': '127.0.0.1', socket.AF_INET: [{'addr': '192.168.242.77', 'broadcast': '127.0.0.1',
'netmask': '255.255.255.0'}], 'netmask': '255.255.255.0'}],
socket.AF_INET6: [{'addr': '2a01:e35:2e27::e59c', 'netmask': 'ffff:ffff:ffff:ffff::/64'}] socket.AF_INET6: [{'addr': '2a01:e35:2e27::e59c', 'netmask': 'ffff:ffff:ffff:ffff::'}]
} }
INTERFACE_DICT['tap'] = { INTERFACE_DICT['tap'] = {
socket.AF_INET6: [{'addr': '2a01:e35:2e27::e59c', 'netmask': 'ffff:ffff:ffff:ffff::/64'}] socket.AF_INET6: [{'addr': '2a01:e35:2e27::e59c', 'netmask': 'ffff:ffff:ffff:ffff::'}]
} }
computer.format(alter_user=False) computer.format(alter_user=False)
...@@ -524,7 +524,7 @@ class TestComputer(SlapformatMixin): ...@@ -524,7 +524,7 @@ class TestComputer(SlapformatMixin):
INTERFACE_DICT['iface'] = { INTERFACE_DICT['iface'] = {
socket.AF_INET: [{'addr': '192.168.242.77', 'broadcast': '127.0.0.1', socket.AF_INET: [{'addr': '192.168.242.77', 'broadcast': '127.0.0.1',
'netmask': '255.255.255.0'}], 'netmask': '255.255.255.0'}],
socket.AF_INET6: [{'addr': '2a01:e35:2e27:3456:1357::e59c', 'netmask': 'ffff:ffff:ffff:ffff:ffff::/48'}] socket.AF_INET6: [{'addr': '2a01:e35:2e27:3456:1357::e59c', 'netmask': 'ffff:ffff:ffff:ffff:ffff::'}]
} }
INTERFACE_DICT['eth1'] = { INTERFACE_DICT['eth1'] = {
socket.AF_INET: [{'addr': '10.8.0.1', 'broadcast': '10.8.0.254', socket.AF_INET: [{'addr': '10.8.0.1', 'broadcast': '10.8.0.254',
...@@ -532,7 +532,7 @@ class TestComputer(SlapformatMixin): ...@@ -532,7 +532,7 @@ class TestComputer(SlapformatMixin):
} }
INTERFACE_DICT['tap'] = { INTERFACE_DICT['tap'] = {
socket.AF_INET6: [{'addr': '2a01:e35:2e27:3456:1357:7890:ffff:ffff', 'netmask': 'ffff:ffff:ffff:ffff:ffff:ffff:ffff/16'}] socket.AF_INET6: [{'addr': '2a01:e35:2e27:3456:1357:7890:ffff:ffff', 'netmask': 'ffff:ffff:ffff:ffff:ffff:ffff:ffff'}]
} }
computer.format(alter_user=False) computer.format(alter_user=False)
...@@ -623,7 +623,7 @@ class TestComputer(SlapformatMixin): ...@@ -623,7 +623,7 @@ class TestComputer(SlapformatMixin):
INTERFACE_DICT['myinterface'] = { INTERFACE_DICT['myinterface'] = {
socket.AF_INET: [{'addr': '192.168.242.77', 'broadcast': '127.0.0.1', socket.AF_INET: [{'addr': '192.168.242.77', 'broadcast': '127.0.0.1',
'netmask': '255.255.255.0'}], 'netmask': '255.255.255.0'}],
socket.AF_INET6: [{'addr': '2a01:e35:2e27::e59c', 'netmask': 'ffff:ffff:ffff:ffff::/64'}] socket.AF_INET6: [{'addr': '2a01:e35:2e27::e59c', 'netmask': 'ffff:ffff:ffff:ffff::'}]
} }
computer.format(alter_network=False, alter_user=False) computer.format(alter_network=False, alter_user=False)
...@@ -663,7 +663,7 @@ class TestComputer(SlapformatMixin): ...@@ -663,7 +663,7 @@ class TestComputer(SlapformatMixin):
INTERFACE_DICT['myinterface'] = { INTERFACE_DICT['myinterface'] = {
socket.AF_INET: [{'addr': '192.168.242.77', 'broadcast': '127.0.0.1', socket.AF_INET: [{'addr': '192.168.242.77', 'broadcast': '127.0.0.1',
'netmask': '255.255.255.0'}], 'netmask': '255.255.255.0'}],
socket.AF_INET6: [{'addr': '2a01:e35:2e27::e59c', 'netmask': 'ffff:ffff:ffff:ffff::/64'}] socket.AF_INET6: [{'addr': '2a01:e35:2e27::e59c', 'netmask': 'ffff:ffff:ffff:ffff::'}]
} }
computer.format(use_unique_local_address_block=True, alter_user=False, create_tap=False) computer.format(use_unique_local_address_block=True, alter_user=False, create_tap=False)
...@@ -725,7 +725,7 @@ class TestComputerWithCPUSet(SlapformatMixin): ...@@ -725,7 +725,7 @@ class TestComputerWithCPUSet(SlapformatMixin):
socket.AF_INET: [ socket.AF_INET: [
{'addr': '127.0.0.1', 'broadcast': '127.0.255.255', 'netmask': '255.255.0.0'}], {'addr': '127.0.0.1', 'broadcast': '127.0.255.255', 'netmask': '255.255.0.0'}],
socket.AF_INET6: [ socket.AF_INET6: [
{'addr': '2a01:e35:2e27::e59c', 'netmask': 'ffff:ffff:ffff:ffff::/64'}] {'addr': '2a01:e35:2e27::e59c', 'netmask': 'ffff:ffff:ffff:ffff::'}]
} }
from slapos.manager.cpuset import Manager from slapos.manager.cpuset import Manager
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment