def add_address(self, address, netprefix, broadcast): if (self.address or self.netprefix or self.netmask) is not None: raise RuntimeError, "Cannot add more than one address to %s interfaces" % (self._KIND,) if broadcast: raise ValueError, "%s interfaces cannot broadcast in PlanetLab (%s)" % (self._KIND,broadcast) self.address = address self.netprefix = netprefix self.netmask = ipaddr2.ipv4_mask2dot(netprefix)
def add_address(self, address, netprefix, broadcast): if (self.address or self.netprefix or self.netmask) is not None: raise RuntimeError, "Cannot add more than one address to %s interfaces" % ( self._KIND, ) if broadcast: raise ValueError, "%s interfaces cannot broadcast in PlanetLab (%s)" % ( self._KIND, broadcast) self.address = address self.netprefix = netprefix self.netmask = ipaddr2.ipv4_mask2dot(netprefix)
def configure(self): routes = self.tc._add_route.get(self.guid, []) iface_guids = self.tc.get_connected(self.guid, "devs", "node") for route in routes: (destination, netprefix, nexthop, metric, device) = route netmask = ipaddr2.ipv4_mask2dot(netprefix) # Validate that the interface is associated to the node for iface_guid in iface_guids: iface = self.tc.elements.get(iface_guid) if iface.devname == device: self.tc.api.execute(self.hostname, "Id#%s" % str(random.getrandbits(128)), "add -net %s netmask %s dev %s" % (destination, netmask, iface.devname), "/sbin/route", # path None, # env ) break
def configure(self): routes = self.tc._add_route.get(self.guid, []) iface_guids = self.tc.get_connected(self.guid, "devs", "node") for route in routes: (destination, netprefix, nexthop, metric, device) = route netmask = ipaddr2.ipv4_mask2dot(netprefix) # Validate that the interface is associated to the node for iface_guid in iface_guids: iface = self.tc.elements.get(iface_guid) if iface.devname == device: self.tc.api.execute( self.hostname, "Id#%s" % str(random.getrandbits(128)), "add -net %s netmask %s dev %s" % (destination, netmask, iface.devname), "/sbin/route", # path None, # env ) break