def __init__(self, name, quaggaConfFile, zebraConfFile, intfDict, *args, **kwargs): Host.__init__(self, name, *args, **kwargs) self.quaggaConfFile = quaggaConfFile self.zebraConfFile = zebraConfFile self.intfDict = intfDict
def __init__(self, name, ip, route, quaggaConfFile, zebraConfFile, *args, **kwargs): Host.__init__(self, name, ip=ip, *args, **kwargs) self.route = route self.quaggaConfFile = quaggaConfFile self.zebraConfFile = zebraConfFile
def config(self, **kwargs): Host.config(self, **kwargs) self.cmd('sysctl net.ipv4.ip_forward=1') for intf,attrs in self.intfDict.items(): self.cmd('ip addr flush dev %s' % intf) if 'mac' in attrs: self.cmd('ip link set %s down' % intf) self.cmd('ip link set %s address %s' % (intf, attrs['mac'])) self.cmd('ip link set %s up' % intf) for addr in attrs['ipAddrs']: self.cmd('ip addr add %s dev %s' % (addr, intf)) self.cmd('usr/lib/quagga/bgpd -d -f %s -z %s/zebra%s.api -i %s/bgpd%s.pid' % (self.quaggaConfFile, QUAGGA_RUN_DIR, self.name, QUAGGA_RUN_DIR, self.name))
def config(self, **kwargs): Host.config(self, **kwargs) debug("configuring route %s" % self.route) self.cmd('ip route add default via %s' % self.route) self.cmd( '/usr/lib/quagga/zebra -d -f %s -z %s/zebra%s.api -i %s/zebra%s.pid' % (self.zebraConfFile, QUAGGA_RUN_DIR, self.name, QUAGGA_RUN_DIR, self.name)) self.cmd( '/usr/lib/quagga/ripd -d -f %s -z %s/zebra%s.api -i %s/ripd%s.pid' % (self.quaggaConfFile, QUAGGA_RUN_DIR, self.name, QUAGGA_RUN_DIR, self.name))
def config(self, **kwargs): Host.config(self, **kwargs) self.cmd('sysctl net.ipv4.ip_forward=1') for intf, attrs in self.intfDict.items(): self.cmd('ip addr flush dev %s' % intf) if 'mac' in attrs: self.cmd('ip link set %s down' % intf) self.cmd('ip link set %s address %s' % (intf, attrs['mac'])) self.cmd('ip link set %s up' % intf) for addr in attrs['ipAddrs']: self.cmd('ip addr add %s dev %s' % (addr, intf)) self.cmd( 'usr/lib/quagga/bgpd -d -f %s -z %s/zebra%s.api -i %s/bgpd%s.pid' % (self.quaggaConfFile, QUAGGA_RUN_DIR, self.name, QUAGGA_RUN_DIR, self.name))
def terminate(self): Host.terminate(self)
def __init__(self,name,quaggaConfFile, intfDict, *args, **kwargs): Host.__init__(self, name, *args, **kwargs) self.quaggaConfFile = quaggaConfFile #self.zebraConfFile = zebraCongFile self.intfDict = intfDict
def config(self, **kwargs): Host.config(self, **kwargs) debug("configuration route %s" % self.route) self.cmd('ip route add default via %s' %self.route)
def __init__(self, name, ip, route, *args, **kwargs): Host.__init__(self, name, ip=ip, *args, **kwargs) self.route = route
def config(self, **kwargs): Host.config(self, **kwargs) debug("configuration route %s" % self.route) self.cmd('ip route add default via %s' % self.route)
def terminate(self): self.cmd( "ps ax | egrep 'ripd%s.pid|zebra%s.pid' | awk '{print $1}' | xargs kill" % (self.name, self.name)) Host.terminate(self)