예제 #1
0
    def gasket_setup(self):
        """Starts the authentication controller app.
        Args:
            host (mininet.host): host to start app on (generally the controller)
        """
        print('Setting up Gasket config.')
        with open('/gasket-src/tests/config/auth.yaml', 'r') as f:
            httpconfig = f.read()

        config_values = {}
        config_values['tmpdir'] = self.tmpdir
        config_values['promport'] = self.prom_port
        config_values['logger_location'] = self.tmpdir + '/auth_app.log'
        serial = faucet_mininet_test_util.get_serialno(self.ports_sock,
                                                       self._test_name())
        portal_name = self._get_sid_prefix(serial) + '1'
        config_values[
            'intf'] = portal_name + '-eth0'  # self.net.hosts[0].defaultIntf().name # need to get this.
        config_values['pid_file'] = self.net.controller.pid_file
        config_values['controller_ip'] = '127.0.0.1'

        open('%s/auth.yaml' % self.tmpdir,
             'w').write(httpconfig % config_values)
        open('%s/base-acls.yaml' % self.tmpdir,
             'w').write(self.CONFIG_BASE_ACL)  # need to get C_B_A

        faucet_acl = self.tmpdir + '/faucet-acl.yaml'
        base = self.tmpdir + '/base-acls.yaml'

        os.system(
            'python3.5 -m gasket.rule_manager {1} {2} > {0}/rule_man.log 2> {0}/rule_man.err'
            .format(self.tmpdir, base, faucet_acl))
        self.verify_hup_faucet()
        print('Faucet successfully hup-ed')
        time.sleep(1)
예제 #2
0
    def build(self,
              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 = faucet_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)
            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
예제 #3
0
 def build(self, ports_sock, test_name, dpids, n_tagged=0, tagged_vid=100, n_untagged=0, links_per_host=0):
     for dpid in dpids:
         serialno = faucet_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)
         switch = self._add_faucet_switch(sid_prefix, dpid)
         self._add_links(switch, self.hosts(), links_per_host)
예제 #4
0
 def build(self, ports_sock, test_name, dpids, n_tagged=0, tagged_vid=100, n_untagged=0, links_per_host=0):
     for dpid in dpids:
         serialno = faucet_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)
         self._add_links(switch, self.hosts(), links_per_host)