Esempio n. 1
0
 def __flowvisor_fs_to_instance(self, fs_dict):
     flowspace = FlowSpace()
     group = Group()
     for datapath in fs_dict.keys():
         dpid = DPID()
         dpid.datapath = datapath
         for port in fs_dict[datapath]["ports"]: 
             of_port = Port()
             of_port.set_num(port)
             dpid.add_port(of_port)
         group.add_dpid(dpid)
         for match in fs_dict[datapath]["matches"]:
             of_match = Match()
             if match.has_key("dl_vlan"):
                 of_match.add_dl_vlan(match["dl_vlan"])
                 group.add_match(of_match)
     flowspace.set_group(group) 
     return flowspace
Esempio n. 2
0
 def __flowvisor_fs_to_instance(self, fs_dict):
     flowspace = FlowSpace()
     group = Group()
     for datapath in fs_dict.keys():
         dpid = DPID()
         dpid.datapath = datapath
         for port in fs_dict[datapath]["ports"]: 
             of_port = Port()
             of_port.set_num(port)
             dpid.add_port(of_port)
         group.add_dpid(dpid)
         for match in fs_dict[datapath]["matches"]:
             of_match = Match()
             if match.has_key("dl_vlan"):
                 of_match.add_dl_vlan(match["dl_vlan"])
                 group.add_match(of_match)
     flowspace.set_group(group) 
     return flowspace
Esempio n. 3
0
    def __parse_to_links(self, links):
        dpid_links = list()
        for link in links:
            src_dpid = DPID()
            src_port = Port()
            src_port.set_num(link[1])
            src_dpid.add_port(src_port)
            src_dpid.set_datapath(link[0])
            src_dpid.set_component_id(self.__generate_dpid_component_id(src_dpid))
            src_dpid.set_component_manager_id(self.__generate_component_manager_id(src_dpid))            
 
            dst_dpid = DPID()
            dst_port = Port()
            dst_port.set_num(link[3])
            dst_dpid.add_port(dst_port)
            dst_dpid.set_datapath(link[2])
            dst_dpid.set_component_id(self.__generate_dpid_component_id(dst_dpid))
            dst_dpid.set_component_manager_id(self.__generate_component_manager_id(dst_dpid))

            link = Link()
            link.set_src_dpid(src_dpid)
            link.set_dst_dpid(dst_dpid)
            link.set_src_port(src_port)
            link.set_dst_port(dst_port)
            link.set_type("Link")
            link.set_component_id(self.__generate_link_component_id(link))
            dpid_links.append(link)
        
        return dpid_links
Esempio n. 4
0
 def __parse_to_switches(self, switches):
     dpids = list()
     for switch in switches:
         dpid = DPID()
         dpid.set_datapath(switch[0])
         dpid.set_ports(self.__parse_to_ports(switch[1])) 
         dpid.set_component_manager_id(self.__generate_component_manager_id(dpid))
         dpid.set_component_id(self.__generate_dpid_component_id(dpid))
         dpid.set_type("Device")
         dpids.append(dpid)
     return dpids
Esempio n. 5
0
    def __parse_to_links(self, links):
        dpid_links = list()
        for link in links:
            src_dpid = DPID()
            src_port = Port()
            src_port.set_num(link[1])
            src_dpid.add_port(src_port)
            src_dpid.set_datapath(link[0])
            src_dpid.set_component_id(self.__generate_dpid_component_id(src_dpid))
            src_dpid.set_component_manager_id(self.__generate_component_manager_id(src_dpid))            
 
            dst_dpid = DPID()
            dst_port = Port()
            dst_port.set_num(link[3])
            dst_dpid.add_port(dst_port)
            dst_dpid.set_datapath(link[2])
            dst_dpid.set_component_id(self.__generate_dpid_component_id(dst_dpid))
            dst_dpid.set_component_manager_id(self.__generate_component_manager_id(dst_dpid))

            link = Link()
            link.set_src_dpid(src_dpid)
            link.set_dst_dpid(dst_dpid)
            link.set_src_port(src_port)
            link.set_dst_port(dst_port)
            link.set_type("Link")
            link.set_component_id(self.__generate_link_component_id(link))
            dpid_links.append(link)
        
        return dpid_links
Esempio n. 6
0
 def __parse_to_switches(self, switches):
     dpids = list()
     for switch in switches:
         dpid = DPID()
         dpid.set_datapath(switch[0])
         dpid.set_ports(self.__parse_to_ports(switch[1])) 
         dpid.set_component_manager_id(self.__generate_component_manager_id(dpid))
         dpid.set_component_id(self.__generate_dpid_component_id(dpid))
         dpid.set_type("Device")
         dpids.append(dpid)
     return dpids