]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Add support for staticd
authorMartin Winter <mwinter@opensourcerouting.org>
Thu, 19 Jul 2018 00:41:24 +0000 (17:41 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Nov 2018 01:22:14 +0000 (20:22 -0500)
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
tests/topotests/lib/topogen.py
tests/topotests/lib/topotest.py

index 9e4132e8fb879f73d117ce814637688db2fc2b69..52b3353f32a101060b09943b7538b2eb8e726fe8 100644 (file)
@@ -530,6 +530,7 @@ class TopoRouter(TopoGear):
     RD_PIM = 9
     RD_EIGRP = 10
     RD_NHRP = 11
+    RD_STATIC = 12
     RD = {
         RD_ZEBRA: 'zebra',
         RD_RIP: 'ripd',
@@ -542,6 +543,7 @@ class TopoRouter(TopoGear):
         RD_LDP: 'ldpd',
         RD_EIGRP: 'eigrpd',
         RD_NHRP: 'nhrpd',
+        RD_STATIC: 'staticd',
     }
 
     def __init__(self, tgen, cls, name, **params):
index 3114d47c9d25c8376403a02e1198b12c4b9b82b6..2d1c2b3c62f1dc568ad5acc943368abcf50c79e9 100644 (file)
@@ -486,7 +486,7 @@ class Router(Node):
         self.routertype = 'frr'
         self.daemons = {'zebra': 0, 'ripd': 0, 'ripngd': 0, 'ospfd': 0,
                         'ospf6d': 0, 'isisd': 0, 'bgpd': 0, 'pimd': 0,
-                        'ldpd': 0, 'eigrpd': 0, 'nhrpd': 0}
+                        'ldpd': 0, 'eigrpd': 0, 'nhrpd': 0, 'staticd': 0}
         self.daemons_options = {'zebra': ''}
         self.reportCores = True
         self.version = None
@@ -632,6 +632,18 @@ class Router(Node):
             self.waitOutput()
             self.cmd('chown %s:%s /etc/%s/%s.conf' % (self.routertype, self.routertype, self.routertype, daemon))
             self.waitOutput()
+            if daemon == 'zebra':
+                # Add staticd with zebra - if it exists
+                staticd_path = os.path.join(self.daemondir, 'staticd')
+                if os.path.isfile(staticd_path):
+                    self.daemons['staticd'] = 1
+                    self.daemons_options['staticd'] = None
+                    self.cmd('touch /etc/%s/%s.conf' % (self.routertype, 'staticd'))
+                    self.waitOutput()
+                    self.cmd('chmod 640 /etc/%s/%s.conf' % (self.routertype, 'staticd'))
+                    self.waitOutput()
+                    self.cmd('chown %s:%s /etc/%s/%s.conf' % (self.routertype, self.routertype, self.routertype, 'staticd'))
+                    self.waitOutput()                    
         else:
             logger.info('No daemon {} known'.format(daemon))
         # print "Daemons after:", self.daemons
@@ -705,15 +717,24 @@ class Router(Node):
             self.waitOutput()
             logger.debug('{}: {} zebra started'.format(self, self.routertype))
             sleep(1, '{}: waiting for zebra to start'.format(self.name))
-        # Fix Link-Local Addresses
+        # Start staticd next if required
+        if self.daemons['staticd'] == 1:
+            staticd_path = os.path.join(self.daemondir, 'staticd')
+            staticd_option = self.daemons_options['staticd']
+            self.cmd('{0} {1} > staticd.out 2> staticd.err &'.format(
+                 staticd_path, staticd_option, self.logdir, self.name
+            ))
+            self.waitOutput()
+            logger.debug('{}: {} staticd started'.format(self, self.routertype))
+            sleep(1, '{}: waiting for staticd to start'.format(self.name))
+       # Fix Link-Local Addresses
         # Somehow (on Mininet only), Zebra removes the IPv6 Link-Local addresses on start. Fix this
         self.cmd('for i in `ls /sys/class/net/` ; do mac=`cat /sys/class/net/$i/address`; IFS=\':\'; set $mac; unset IFS; ip address add dev $i scope link fe80::$(printf %02x $((0x$1 ^ 2)))$2:${3}ff:fe$4:$5$6/64; done')
         # Now start all the other daemons
         for daemon in self.daemons:
             # Skip disabled daemons and zebra
-            if self.daemons[daemon] == 0 or daemon == 'zebra':
+            if self.daemons[daemon] == 0 or daemon == 'zebra' or daemon == 'staticd':
                 continue
-
             daemon_path = os.path.join(self.daemondir, daemon)
             self.cmd('{0} > {3}.out 2> {3}.err &'.format(
                 daemon_path, self.logdir, self.name, daemon