[./gestion/midtools.py] Bugfixes
darcs-hash:20100131223618-8fbb1-81cf2ad482e79ee27cd3584d042fb9b16989b4a7.gz
This commit is contained in:
parent
662dbb01b5
commit
f97be2ce42
1 changed files with 8 additions and 10 deletions
|
@ -72,8 +72,9 @@ class Mid(object):
|
|||
if self.type is None:
|
||||
raise ValueError("Impossible de convertir l'adresse IP")
|
||||
|
||||
self.mid = iptools.QuadToDec(ip)
|
||||
self.mid -= iptools.param(config.NETs[self.type], True)['network']
|
||||
self.mid = int(iptools.QuadToDec(ip))
|
||||
self.mid -= int(iptools.param(config.NETs[self.type][0],
|
||||
True)['network'])
|
||||
self.reste = self.mid & 0x7ff
|
||||
# if self.type == 'ens': # Inutile pour l'instant
|
||||
# self.reste &= 0xff
|
||||
|
@ -85,21 +86,18 @@ class Mid(object):
|
|||
if not self.ipv4_dispo:
|
||||
raise ValueError("Pas d'adresse ipv4 disponible pour la machine")
|
||||
|
||||
ip = iptools.param(config.NETs[self.type], True)['network']
|
||||
ip = iptools.param(config.NETs[self.type][0], True)['network']
|
||||
ip += self.reste
|
||||
return iptools.DecToQuad(ip)
|
||||
|
||||
def to_ipv6_vlan(self):
|
||||
"""
|
||||
Génère le VLAN IPv6 associé à la machine
|
||||
Génère le préfix IPv6 associé à la machine
|
||||
"""
|
||||
if priv:
|
||||
raise ValueError("Pas d'adresse ipv6 disponible pour la machine")
|
||||
if self.priv:
|
||||
raise ValueError("Pas de prefix ipv6 disponible pour cette machine")
|
||||
|
||||
tp = {'fil': 'fil', 'fil-v6': 'fil',
|
||||
'wifi': 'wifi', 'wifi-v6': 'wifi',
|
||||
'adm': 'adm'}[self.type]
|
||||
ip = config.prefix[tp][0].split(":/")[0]
|
||||
ip = config.prefix['subnet'][0].split(":/")[0]
|
||||
ip += hex(self.mid)[2:]
|
||||
ip += "::/64"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue