Пример #1
0
    def gen_mgmt(self):
        """ Generate qemu args for the mgmt interface(s)
        """
        res = []
        # mgmt interface
        res.extend([
            "-device",
            "virtio-net-pci,netdev=mgmt,mac=%s" % vrnetlab.gen_mac(0)
        ])
        res.extend([
            "-netdev",
            "user,id=mgmt,net=10.0.0.0/24,tftp=/tftpboot,%s" %
            self.gen_host_forwards()
        ])
        # dummy interface for xrv9k ctrl interface
        res.extend([
            "-device",
            "virtio-net-pci,netdev=ctrl-dummy,id=ctrl-dummy,mac=%s" %
            vrnetlab.gen_mac(0), "-netdev",
            "tap,ifname=ctrl-dummy,id=ctrl-dummy,script=no,downscript=no"
        ])
        # dummy interface for xrv9k dev interface
        res.extend([
            "-device",
            "virtio-net-pci,netdev=dev-dummy,id=dev-dummy,mac=%s" %
            vrnetlab.gen_mac(0), "-netdev",
            "tap,ifname=dev-dummy,id=dev-dummy,script=no,downscript=no"
        ])

        return res
Пример #2
0
    def gen_mgmt(self):
        """ Generate mgmt interface(s)

            We override the default function since we want a virtio NIC to the
            vFPC
        """
        # call parent function to generate first mgmt interface (e1000)
        res = super(VQFX_vcp, self).gen_mgmt()
        # add virtio NIC for internal control plane interface to vFPC
        res.append("-device")
        res.append("e1000,netdev=vcp-int,mac=%s" % vrnetlab.gen_mac(1))
        res.append("-netdev")
        res.append("tap,ifname=vcp-int,id=vcp-int,script=no,downscript=no")

        # dummy
        for i in range(1):
            res.append("-device")
            res.append("e1000,netdev=dummy%d,mac=%s" %
                       (i, vrnetlab.gen_mac(1)))
            res.append("-netdev")
            res.append(
                "tap,ifname=dummy%d,id=dummy%d,script=no,downscript=no" %
                (i, i))

        return res
Пример #3
0
    def gen_mgmt(self):
        """Generate qemu args for the mgmt interface(s)"""
        res = []
        # mgmt interface
        res.extend([
            "-device",
            "virtio-net-pci,netdev=mgmt,mac=%s" % vrnetlab.gen_mac(0)
        ])
        res.extend([
            "-netdev",
            "user,id=mgmt,net=10.0.0.0/24,tftp=/tftpboot,hostfwd=tcp::2022-10.0.0.15:22,hostfwd=udp::2161-10.0.0.15:161,hostfwd=tcp::2830-10.0.0.15:830",
        ])
        # dummy interface for xrv9k ctrl interface
        res.extend([
            "-device",
            "virtio-net-pci,netdev=ctrl-dummy,id=ctrl-dummy,mac=%s" %
            vrnetlab.gen_mac(0),
            "-netdev",
            "tap,ifname=ctrl-dummy,id=ctrl-dummy,script=no,downscript=no",
        ])
        # dummy interface for xrv9k dev interface
        res.extend([
            "-device",
            "virtio-net-pci,netdev=dev-dummy,id=dev-dummy,mac=%s" %
            vrnetlab.gen_mac(0),
            "-netdev",
            "tap,ifname=dev-dummy,id=dev-dummy,script=no,downscript=no",
        ])

        return res
Пример #4
0
    def gen_mgmt(self):
        res = []
        # mgmt interface
        res.extend([
            "-device",
            "virtio-net-pci,netdev=mgmt,mac=%s" % vrnetlab.gen_mac(0)
        ])
        res.extend(["-netdev", "user,id=mgmt,net=10.0.0.0/24"])
        # internal control plane interface to vFPC
        res.extend([
            "-device",
            "virtio-net-pci,netdev=vfpc-int,mac=%s" % vrnetlab.gen_mac(0)
        ])
        res.extend([
            "-netdev",
            "tap,ifname=vfpc-int,id=vfpc-int,script=no,downscript=no"
        ])

        if self.version not in ("vmx-14.1R6.4"):
            # dummy interface for some vMX versions - not sure why vFPC wants
            # it but without it we get a misalignment
            res.extend([
                "-device",
                "virtio-net-pci,netdev=dummy,mac=%s" % vrnetlab.gen_mac(0)
            ])
            res.extend([
                "-netdev",
                "tap,ifname=vfpc-dummy,id=dummy,script=no,downscript=no"
            ])

        return res
Пример #5
0
    def gen_mgmt(self):
        res = []
        # mgmt interface
        res.extend(["-device", "e1000,netdev=mgmt,mac=%s" % vrnetlab.gen_mac(0)])
        res.extend(["-netdev", "user,id=mgmt,net=10.0.0.0/24"])
        # internal control plane interface to vFPC
        res.extend(["-device", "e1000,netdev=vpfe-int,mac=%s" %
                    vrnetlab.gen_mac(0)])
        res.extend(["-netdev",
                    "tap,ifname=vpfe-int,id=vpfe-int,script=no,downscript=no"])

        return res
Пример #6
0
 def gen_mgmt(self):
     """ Generate mgmt interface
     """
     res = []
     # mgmt interface
     res.extend(["-device", "e1000,netdev=mgmt,mac=%s" % vrnetlab.gen_mac(0)])
     res.extend(["-netdev", "user,id=mgmt,net=10.0.0.0/24"])
     # internal control plane interface to vFPC
     res.extend(["-device", "e1000,netdev=vfpc-int,mac=%s" %
                 vrnetlab.gen_mac(0)])
     res.extend(["-netdev",
                 "tap,ifname=vfpc{}-int,id=vfpc-int,script=no,downscript=no".format(self.slot)])
     return res
Пример #7
0
    def gen_mgmt(self):
        res = []
        # mgmt interface
        res.extend(
            ["-device",
             "e1000,netdev=mgmt,mac=%s" % vrnetlab.gen_mac(0)])
        res.extend(["-netdev", "user,id=mgmt,net=10.0.0.0/24"])
        # internal control plane interface to vFPC
        res.extend(
            ["-device",
             "e1000,netdev=vpfe-int,mac=%s" % vrnetlab.gen_mac(0)])
        res.extend([
            "-netdev",
            "tap,ifname=vpfe-int,id=vpfe-int,script=no,downscript=no"
        ])

        return res
Пример #8
0
 def gen_mgmt(self):
     """Generate mgmt interface"""
     res = []
     # mgmt interface
     res.extend(
         ["-device",
          "e1000,netdev=mgmt,mac=%s" % vrnetlab.gen_mac(0)])
     res.extend(["-netdev", "user,id=mgmt,net=10.0.0.0/24"])
     # internal control plane interface to vFPC
     res.extend(
         ["-device",
          "e1000,netdev=vfpc-int,mac=%s" % vrnetlab.gen_mac(0)])
     res.extend([
         "-netdev",
         "tap,ifname=vfpc{}-int,id=vfpc-int,script=no,downscript=no".format(
             self.slot),
     ])
     return res
Пример #9
0
    def gen_mgmt(self):
        res = []
        # mgmt interface
        res.extend(["-device", "virtio-net-pci,netdev=mgmt,mac=%s" % vrnetlab.gen_mac(0)])
        res.extend(["-netdev", "user,id=mgmt,net=10.0.0.0/24"])
        # internal control plane interface to vFPC
        res.extend(["-device", "virtio-net-pci,netdev=vfpc-int,mac=%s" %
                    vrnetlab.gen_mac(0)])
        res.extend(["-netdev",
                    "tap,ifname=vfpc-int,id=vfpc-int,script=no,downscript=no"])

        if self.version in ('15.1F6.9', '16.1R2.11'):
            # dummy interface for some vMX versions - not sure why vFPC wants
            # it but without it we get a misalignment
            res.extend(["-device", "virtio-net-pci,netdev=dummy,mac=%s" %
                                   vrnetlab.gen_mac(0)])
            res.extend(["-netdev", "tap,ifname=vfpc-dummy,id=dummy,script=no,downscript=no"])

        return res
Пример #10
0
    def gen_mgmt(self):
        """
        Generate mgmt interface(s)
        """
        res = []

        res.append("-device")

        res.append(
            self.nic_type + ",netdev=br-mgmt,mac=%(mac)s" % {"mac": vrnetlab.gen_mac(0)}
        )
        res.append("-netdev")
        res.append("bridge,br=br-mgmt,id=br-mgmt" % {"i": 0})

        # add virtio NIC for internal control plane interface to vFPC
        res.append("-device")
        res.append("virtio-net-pci,netdev=vcp-int,mac=%s" % vrnetlab.gen_mac(1))
        res.append("-netdev")
        res.append("tap,ifname=vcp-int,id=vcp-int,script=no,downscript=no")
        return res
Пример #11
0
    def gen_mgmt(self):
        """Generate qemu args for the mgmt interface(s)"""
        res = []
        # mgmt interface
        res.extend(
            ["-device", "virtio-net-pci,netdev=mgmt,mac=%s" % vrnetlab.gen_mac(0)]
        )
        res.extend(
            [
                "-netdev",
                "user,id=mgmt,net=10.0.0.0/24,tftp=/tftpboot,hostfwd=tcp::2022-10.0.0.15:22,hostfwd=udp::2161-10.0.0.15:161,hostfwd=tcp::2830-10.0.0.15:830,hostfwd=tcp::17400-10.0.0.15:57400",
            ]
        )
        # dummy interface for xrv9k ctrl interface
        res.extend(
            [
                "-device",
                "virtio-net-pci,netdev=ctrl-dummy,id=ctrl-dummy,mac=%s"
                % vrnetlab.gen_mac(0),
                "-netdev",
                "tap,ifname=ctrl-dummy,id=ctrl-dummy,script=no,downscript=no",
            ]
        )
        # dummy interface for xrv9k dev interface
        res.extend(
            [
                "-device",
                "virtio-net-pci,netdev=dev-dummy,id=dev-dummy,mac=%s"
                % vrnetlab.gen_mac(0),
                "-netdev",
                "tap,ifname=dev-dummy,id=dev-dummy,script=no,downscript=no",
            ]
        )
        # add socat for gNMI port we added on L76, since it's not part of vrnetlab core lib
        vrnetlab.run_command(
            ["socat", "TCP-LISTEN:57400,fork", "TCP:127.0.0.1:17400"],
            background=True,
        )

        return res
Пример #12
0
    def gen_mgmt(self):
        """ Generate mgmt interface(s)

            We override the default function since we want a NIC to the vFPC
        """
        # call parent function to generate first mgmt interface (e1000)
        res = super(SROS_cp, self).gen_mgmt()
        # add virtio NIC for internal control plane interface to vFPC
        res.append("-device")
        res.append("e1000,netdev=vcp-int,mac=%s" % vrnetlab.gen_mac(1))
        res.append("-netdev")
        res.append("tap,ifname=vcp-int,id=vcp-int,script=no,downscript=no")
        return res
Пример #13
0
    def gen_mgmt(self):
        """ Generate mgmt interface(s)

            We override the default function since we want a fake NIC in there
        """
        # call parent function to generate first mgmt interface (e1000)
        res = super(SROS_integrated, self).gen_mgmt()
        # add virtio NIC for internal control plane interface to vFPC
        res.append("-device")
        res.append("e1000,netdev=dummy0,mac=%s" % vrnetlab.gen_mac(1))
        res.append("-netdev")
        res.append("tap,ifname=dummy0,id=dummy0,script=no,downscript=no")
        return res
Пример #14
0
 def gen_nics(self):
     """ Generate qemu args for the normal traffic carrying interface(s)
     """
     res = []
     # TODO: should this offset business be put in the common vrnetlab?
     offset = 6 * (self.slot-1)
     for j in range(0, self.num_nics):
         i = offset + j + 1
         res.append("-device")
         res.append(self.nic_type + ",netdev=p%(i)02d,mac=%(mac)s"
                    % { 'i': i, 'mac': vrnetlab.gen_mac(i) })
         res.append("-netdev")
         res.append("socket,id=p%(i)02d,listen=:100%(i)02d"
                    % { 'i': i })
     return res
Пример #15
0
    def gen_mgmt(self):
        """ Generate mgmt interface(s)

            We override the default function since we want a virtio NIC to the
            vFPC
        """
        # call parent function to generate first mgmt interface (e1000)
        res = super(VMX_vcp, self).gen_mgmt()
        if not self.install_mode:
            # add virtio NIC for internal control plane interface to vFPC
            res.append("-device")
            res.append("virtio-net-pci,netdev=vcp-int,mac=%s" % vrnetlab.gen_mac(1))
            res.append("-netdev")
            res.append("tap,ifname=vcp-int,id=vcp-int,script=no,downscript=no")
        return res
Пример #16
0
 def gen_nics(self):
     """ Generate qemu args for the normal traffic carrying interface(s)
     """
     res = []
     # TODO: should this offset business be put in the common vrnetlab?
     offset = 6 * (self.slot - 1)
     for j in range(0, self.num_nics):
         i = offset + j + 1
         res.append("-device")
         res.append(self.nic_type + ",netdev=p%(i)02d,mac=%(mac)s" % {
             'i': i,
             'mac': vrnetlab.gen_mac(i)
         })
         res.append("-netdev")
         res.append("socket,id=p%(i)02d,listen=:100%(i)02d" % {'i': i})
     return res
Пример #17
0
    def gen_mgmt(self):
        """Generate mgmt interface(s)

        We override the default function since we want a virtio NIC to the
        vFPC
        """
        # call parent function to generate first mgmt interface (e1000)
        res = super(VMX_vcp, self).gen_mgmt()
        if not self.install_mode:
            # append gNMI forwarding if it was not added by common lib
            if "hostfwd=tcp::57400-10.0.0.15:57400" not in res[-1]:
                res[-1] = res[-1] + ",hostfwd=tcp::17400-10.0.0.15:57400"
                vrnetlab.run_command(
                    ["socat", "TCP-LISTEN:57400,fork", "TCP:127.0.0.1:17400"],
                    background=True,
                )
            # add virtio NIC for internal control plane interface to vFPC
            res.append("-device")
            res.append("virtio-net-pci,netdev=vcp-int,mac=%s" %
                       vrnetlab.gen_mac(1))
            res.append("-netdev")
            res.append("tap,ifname=vcp-int,id=vcp-int,script=no,downscript=no")
        return res
Пример #18
0
    def gen_mgmt(self):
        """ Generate mgmt interface(s)

            We override the default function since we want a virtio NIC to the
            vFPC
        """
        # call parent function to generate first mgmt interface (e1000)
        res = super(VMX_vcp, self).gen_mgmt()
        # install mode doesn't need host port forwarding rules. if running in
        # dual-re mode, replace host port forwarding rules for the backup
        # routing engine
        if self.install_mode:
            res[-1] = re.sub(r',hostfwd.*', '', res[-1])
        elif self.dual_re and self.num == 1:
            res[-1] = re.sub(r',hostfwd.*', self.gen_host_forwards(mgmt_ip='10.0.0.16', offset=3000), res[-1])

        if not self.install_mode:
            # add virtio NIC for internal control plane interface to vFPC
            res.append("-device")
            res.append("virtio-net-pci,netdev=%s,mac=%s" % (self._vcp_int, vrnetlab.gen_mac(1)))
            res.append("-netdev")
            res.append("tap,ifname=%(_vcp_int)s,id=%(_vcp_int)s,script=no,downscript=no" % { '_vcp_int': self._vcp_int })
        return res
Пример #19
0
    def gen_mgmt(self):
        """
        Generate SR OS MGMT interface connected to a mgmt bridge
        """

        res = []

        res.append("-device")

        res.append(
            self.nic_type + ",netdev=br-mgmt,mac=%(mac)s" % {"mac": vrnetlab.gen_mac(0)}
        )
        res.append("-netdev")
        res.append("bridge,br=br-mgmt,id=br-mgmt" % {"i": 0})

        if "chassis=ixr-r6" in self.variant["timos_line"]:
            logger.debug(
                "detected ixr-r6 chassis, creating a dummy network device for SFM connection"
            )
            res.append(f"-device virtio-net-pci,netdev=dummy,mac={vrnetlab.gen_mac(0)}")
            res.append(f"-netdev tap,ifname=sfm-dummy,id=dummy,script=no,downscript=no")

        return res