def _add_faucet_fib_to_vip(self, vlan, priority, faucet_vip, faucet_vip_host): learn_connected_priority = self.route_priority + faucet_vip.network.prefixlen faucet_mac = vlan.faucet_mac insts = [valve_of.goto_table(self.fib_table)] if self._global_routing(): vlan_mac = valve_packet.int_in_mac(faucet_mac, vlan.vid) insts = [valve_of.apply_actions([ valve_of.set_eth_dst(vlan_mac), valve_of.set_vlan_vid(self.global_vlan.vid)])] + insts ofmsgs = [] ofmsgs.append(self.eth_src_table.flowmod( self.eth_src_table.match(eth_type=self.ETH_TYPE, eth_dst=faucet_mac, vlan=vlan), priority=self.route_priority, inst=insts)) routed_vlans = self._routed_vlans(vlan) if self._global_routing(): vlan = self.global_vlan ofmsgs.append(self.fib_table.flowmod( self._route_match(vlan, faucet_vip_host), priority=priority, inst=[valve_of.goto_table(self.vip_table)])) if self.proactive_learn and not faucet_vip.ip.is_link_local: for routed_vlan in routed_vlans: ofmsgs.append(self.fib_table.flowmod( self._route_match(routed_vlan, faucet_vip), priority=learn_connected_priority, inst=[valve_of.goto_table(self.vip_table)])) ofmsgs.append(self.vip_table.flowcontroller( self.vip_table.match(eth_type=self.ETH_TYPE), priority=priority-1, max_len=self.MAX_LEN)) return ofmsgs
def _add_faucet_fib_to_vip(self, vlan, priority, faucet_vip, faucet_vip_host): """Router flowmods""" ofmsgs = [] learn_connected_priority = self.route_priority + faucet_vip.network.prefixlen faucet_mac = vlan.faucet_mac actions = None if self.global_routing: vlan_mac = valve_packet.int_in_mac(faucet_mac, vlan.vid) actions = [ self.fib_table.set_field(eth_dst=vlan_mac), self.fib_table.set_vlan_vid(self.global_vlan.vid) ] ofmsgs.extend( self.pipeline.select_packets(self.fib_table, { 'eth_type': self.ETH_TYPE, 'eth_dst': faucet_mac, 'vlan': vlan }, actions)) if self.global_routing: vlan = self.global_vlan ofmsgs.append( self.fib_table.flowmod(self._route_match(vlan, faucet_vip_host), priority=priority, inst=[self.fib_table.goto(self.vip_table)])) if self.proactive_learn and not faucet_vip.ip.is_link_local: routed_vlans = self._routed_vlans(vlan) for routed_vlan in routed_vlans: ofmsgs.append( self.fib_table.flowmod( self._route_match(routed_vlan, faucet_vip), priority=learn_connected_priority, inst=[self.fib_table.goto(self.vip_table)])) # Unicast ICMP to us. priority -= 1 ofmsgs.append( self.vip_table.flowcontroller(self.vip_table.match( eth_type=self.ETH_TYPE, eth_dst=faucet_mac, nw_proto=self.ICMP_TYPE), priority=priority, max_len=self.ICMP_SIZE)) # Learn + flood other ICMP not unicast to us. priority -= 1 ofmsgs.append( self.vip_table.flowmod(self.vip_table.match( eth_type=self.ETH_TYPE, nw_proto=self.ICMP_TYPE), priority=priority, inst=self._controller_and_flood())) # Learn from other IP traffic unicast to us. priority -= 1 ofmsgs.append( self.vip_table.flowcontroller(self.vip_table.match( eth_type=self.ETH_TYPE, eth_dst=faucet_mac), priority=priority, max_len=self.ICMP_SIZE)) # Learn + flood IP traffic not unicast to us. priority -= 1 ofmsgs.append( self.vip_table.flowmod( self.vip_table.match(eth_type=self.ETH_TYPE), priority=priority, inst=self._controller_and_flood())) return ofmsgs
def _add_faucet_fib_to_vip(self, vlan, priority, faucet_vip, faucet_vip_host): ofmsgs = [] learn_connected_priority = self.route_priority + faucet_vip.network.prefixlen faucet_mac = vlan.faucet_mac insts = [self.classification_table.goto(self.fib_table)] if self.global_routing: vlan_mac = valve_packet.int_in_mac(faucet_mac, vlan.vid) insts = [valve_of.apply_actions([ self.fib_table.set_field(eth_dst=vlan_mac), self.fib_table.set_vlan_vid(self.global_vlan.vid)])] + insts ofmsgs.append(self.classification_table.flowmod( self.classification_table.match( eth_type=self.ETH_TYPE, eth_dst=faucet_mac, vlan=vlan), priority=self.route_priority, inst=insts)) if self.global_routing: vlan = self.global_vlan ofmsgs.append(self.fib_table.flowmod( self._route_match(vlan, faucet_vip_host), priority=priority, inst=[self.fib_table.goto(self.vip_table)])) if self.proactive_learn and not faucet_vip.ip.is_link_local: routed_vlans = self._routed_vlans(vlan) for routed_vlan in routed_vlans: ofmsgs.append(self.fib_table.flowmod( self._route_match(routed_vlan, faucet_vip), priority=learn_connected_priority, inst=[self.fib_table.goto(self.vip_table)])) # Unicast ICMP to us. priority -= 1 ofmsgs.append(self.vip_table.flowcontroller( self.vip_table.match( eth_type=self.ETH_TYPE, eth_dst=faucet_mac, nw_proto=self.ICMP_TYPE), priority=priority, max_len=self.ICMP_SIZE)) # Learn + flood other ICMP not unicast to us. priority -= 1 ofmsgs.append(self.vip_table.flowmod( self.vip_table.match( eth_type=self.ETH_TYPE, nw_proto=self.ICMP_TYPE), priority=priority, inst=self._controller_and_flood())) # Learn from other IP traffic unicast to us. priority -= 1 ofmsgs.append(self.vip_table.flowcontroller( self.vip_table.match( eth_type=self.ETH_TYPE, eth_dst=faucet_mac), priority=priority, max_len=self.ICMP_SIZE)) # Learn + flood IP traffic not unicast to us. priority -= 1 ofmsgs.append(self.vip_table.flowmod( self.vip_table.match( eth_type=self.ETH_TYPE), priority=priority, inst=self._controller_and_flood())) return ofmsgs