Ejemplo n.º 1
0
    def __init__(self, name, quaggaConfFile, zebraConfFile, intfDict, *args,
                 **kwargs):
        Host.__init__(self, name, *args, **kwargs)

        self.quaggaConfFile = quaggaConfFile
        self.zebraConfFile = zebraConfFile
        self.intfDict = intfDict
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
	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))
Ejemplo n.º 4
0
    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))
Ejemplo n.º 5
0
    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))
Ejemplo n.º 6
0
	def terminate(self):
		Host.terminate(self)
Ejemplo n.º 7
0
	def __init__(self,name,quaggaConfFile, intfDict, *args, **kwargs):
		Host.__init__(self, name, *args, **kwargs)
		self.quaggaConfFile = quaggaConfFile
		#self.zebraConfFile = zebraCongFile
		self.intfDict = intfDict
Ejemplo n.º 8
0
	def config(self, **kwargs):
		Host.config(self, **kwargs)
		debug("configuration route %s" % self.route)
		self.cmd('ip route add default via %s' %self.route)
Ejemplo n.º 9
0
	def __init__(self, name, ip, route, *args, **kwargs):
		Host.__init__(self, name, ip=ip, *args, **kwargs)
		self.route = route
Ejemplo n.º 10
0
 def terminate(self):
     Host.terminate(self)
Ejemplo n.º 11
0
 def config(self, **kwargs):
     Host.config(self, **kwargs)
     debug("configuration route %s" % self.route)
     self.cmd('ip route add default via %s' % self.route)
Ejemplo n.º 12
0
 def __init__(self, name, ip, route, *args, **kwargs):
     Host.__init__(self, name, ip=ip, *args, **kwargs)
     self.route = route
Ejemplo n.º 13
0
    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)