Example #1
0
 def build(self,
           ovs_type,
           ports_sock,
           test_name,
           dpids,
           n_tagged=0,
           tagged_vid=100,
           n_untagged=0,
           links_per_host=0,
           n_extended=0,
           e_cls=None,
           tmpdir=None,
           hw_dpid=None):
     for dpid in dpids:
         serialno = mininet_test_util.get_serialno(ports_sock, test_name)
         sid_prefix = self._get_sid_prefix(serialno)
         for host_n in range(n_tagged):
             self._add_tagged_host(sid_prefix, tagged_vid, host_n)
         for host_n in range(n_untagged):
             self._add_untagged_host(sid_prefix, host_n)
         for host_n in range(n_extended):
             self._add_extended_host(sid_prefix, host_n, e_cls, tmpdir)
         switch_cls = FaucetSwitch
         if hw_dpid and hw_dpid == dpid:
             remap_dpid = str(int(dpid) + 1)
             output(
                 'bridging hardware switch DPID %s (%x) dataplane via OVS DPID %s (%x)'
                 % (dpid, int(dpid), remap_dpid, int(remap_dpid)))
             dpid = remap_dpid
             switch_cls = NoControllerFaucetSwitch
         switch = self._add_faucet_switch(sid_prefix, dpid, ovs_type,
                                          switch_cls)
         self._add_links(switch, self.hosts(), links_per_host)
Example #2
0
    def build(self,
              ovs_type,
              ports_sock,
              test_name,
              dpids,
              n_tagged=0,
              tagged_vid=100,
              n_untagged=0,
              links_per_host=0,
              switch_to_switch_links=1):
        """

                               Hosts
                               ||||
                               ||||
                 +----+       +----+       +----+
              ---+1   |       |1234|       |   1+---
        Hosts ---+2   |       |    |       |   2+--- Hosts
              ---+3   |       |    |       |   3+---
              ---+4  5+-------+5  6+-------+5  4+---
                 +----+       +----+       +----+

                 Faucet-1     Faucet-2     Faucet-3

                   |            |            |
                   |            |            |
                   +-------- controller -----+

        * s switches (above S = 3; for S > 3, switches are added to the chain)
        * (n_tagged + n_untagged) hosts per switch
        * (n_tagged + n_untagged + 1) links on switches 0 and s-1,
          with final link being inter-switch
        * (n_tagged + n_untagged + 2) links on switches 0 < n < s-1,
          with final two links being inter-switch
        """
        last_switch = None
        self.switch_to_switch_links = switch_to_switch_links
        for dpid in dpids:
            serialno = mininet_test_util.get_serialno(ports_sock, test_name)
            sid_prefix = self._get_sid_prefix(serialno)
            hosts = []
            for host_n in range(n_tagged):
                hosts.append(
                    self._add_tagged_host(sid_prefix, tagged_vid, host_n))
            for host_n in range(n_untagged):
                hosts.append(self._add_untagged_host(sid_prefix, host_n))
            switch = self._add_faucet_switch(sid_prefix, dpid, ovs_type)
            self._add_links(switch, hosts, links_per_host)
            if last_switch is not None:
                # Add a switch-to-switch link with the previous switch,
                # if this isn't the first switch in the topology.
                for _ in range(self.switch_to_switch_links):
                    self.addLink(last_switch, switch)
            last_switch = switch
 def build(self, ovs_type, ports_sock, test_name, dpids,
           n_tagged=0, tagged_vid=100, n_untagged=0, links_per_host=0,
           n_extended=0, e_cls=None, tmpdir=None):
     for dpid in dpids:
         serialno = mininet_test_util.get_serialno(
             ports_sock, test_name)
         sid_prefix = self._get_sid_prefix(serialno)
         for host_n in range(n_tagged):
             self._add_tagged_host(sid_prefix, tagged_vid, host_n)
         for host_n in range(n_untagged):
             self._add_untagged_host(sid_prefix, host_n)
         for host_n in range(n_extended):
             self._add_extended_host(sid_prefix, host_n, e_cls, tmpdir)
         switch = self._add_faucet_switch(sid_prefix, dpid, ovs_type)
         self._add_links(switch, self.hosts(), links_per_host)
Example #4
0
 def build(self,
           ovs_type,
           ports_sock,
           test_name,
           dpids,
           n_tagged=0,
           tagged_vid=100,
           n_untagged=0,
           links_per_host=0):
     for dpid in dpids:
         serialno = mininet_test_util.get_serialno(ports_sock, test_name)
         sid_prefix = self._get_sid_prefix(serialno)
         for host_n in range(n_tagged):
             self._add_tagged_host(sid_prefix, tagged_vid, host_n)
         for host_n in range(n_untagged):
             self._add_untagged_host(sid_prefix, host_n)
         remap_dpid = str(int(dpid) + 1)
         output(
             'bridging hardware switch DPID %s (%x) dataplane via OVS DPID %s (%x)'
             % (dpid, int(dpid), remap_dpid, int(remap_dpid)))
         dpid = remap_dpid
         switch = self._add_faucet_switch(sid_prefix, dpid, ovs_type)
         self._add_links(switch, self.hosts(), links_per_host)
Example #5
0
    def build(self,
              ovs_type,
              ports_sock,
              test_name,
              dpids,
              n_tagged=0,
              tagged_vid=100,
              n_untagged=0,
              links_per_host=0,
              switch_to_switch_links=1,
              hw_dpid=None,
              stack_ring=False):
        """

                               Hosts
                               ||||
                               ||||
                 +----+       +----+       +----+
              ---+1   |       |1234|       |   1+---
        Hosts ---+2   |       |    |       |   2+--- Hosts
              ---+3   |       |    |       |   3+---
              ---+4  5+-------+5  6+-------+5  4+---
                 +----+       +----+       +----+

                 Faucet-1     Faucet-2     Faucet-3

                   |            |            |
                   |            |            |
                   +-------- controller -----+

        * s switches (above S = 3; for S > 3, switches are added to the chain)
        * (n_tagged + n_untagged) hosts per switch
        * (n_tagged + n_untagged + 1) links on switches 0 and s-1,
          with final link being inter-switch
        * (n_tagged + n_untagged + 2) links on switches 0 < n < s-1,
          with final two links being inter-switch
        """
        def addLinks(src, dst):
            for _ in range(self.switch_to_switch_links):
                self.addLink(src, dst)

        first_switch = None
        last_switch = None
        self.switch_to_switch_links = switch_to_switch_links
        for dpid in dpids:
            serialno = mininet_test_util.get_serialno(ports_sock, test_name)
            sid_prefix = self._get_sid_prefix(serialno)
            hosts = []
            for host_n in range(n_tagged):
                hosts.append(
                    self._add_tagged_host(sid_prefix, tagged_vid, host_n))
            for host_n in range(n_untagged):
                hosts.append(self._add_untagged_host(sid_prefix, host_n))
            switch_cls = FaucetSwitch
            if hw_dpid and hw_dpid == dpid:
                remap_dpid = str(int(dpid) + 1)
                output(
                    'bridging hardware switch DPID %s (%x) dataplane via OVS DPID %s (%x)'
                    % (dpid, int(dpid), remap_dpid, int(remap_dpid)))
                dpid = remap_dpid
                switch_cls = NoControllerFaucetSwitch
            switch = self._add_faucet_switch(sid_prefix, dpid, ovs_type,
                                             switch_cls)
            self._add_links(switch, hosts, links_per_host)
            if first_switch is None:
                first_switch = switch
            if last_switch is not None:
                # Add a switch-to-switch link with the previous switch,
                # if this isn't the first switch in the topology.
                addLinks(last_switch, switch)
            last_switch = switch
        if stack_ring:
            addLinks(first_switch, last_switch)