Example #1
0
 def _add_faucet_vip_nd(self, vlan, priority, faucet_vip, faucet_vip_host):
     faucet_vip_host_nd_mcast = valve_packet.ipv6_link_eth_mcast(
         valve_packet.ipv6_solicited_node_from_ucast(faucet_vip.ip))
     controller_and_flood = [
         valve_of.apply_actions([valve_of.output_controller()]),
         valve_of.goto_table(self.flood_table)]
     ofmsgs = []
     ofmsgs.append(self.eth_src_table.flowmod(
         self.eth_src_table.match(
             eth_type=self.ETH_TYPE,
             eth_dst=faucet_vip_host_nd_mcast,
             vlan=vlan,
             nw_proto=inet.IPPROTO_ICMPV6,
             icmpv6_type=icmpv6.ND_NEIGHBOR_SOLICIT),
         priority=priority,
         inst=controller_and_flood))
     ofmsgs.append(self.eth_src_table.flowcontroller(
         self.eth_src_table.match(
             eth_type=self.ETH_TYPE,
             eth_dst=vlan.faucet_mac,
             vlan=vlan,
             nw_proto=inet.IPPROTO_ICMPV6,
             icmpv6_type=icmpv6.ND_NEIGHBOR_ADVERT),
         priority=priority))
     if faucet_vip.ip in valve_packet.IPV6_LINK_LOCAL:
         ofmsgs.append(self.eth_src_table.flowmod(
             self.eth_src_table.match(
                 eth_type=self.ETH_TYPE,
                 eth_dst=valve_packet.IPV6_ALL_ROUTERS_MCAST,
                 vlan=vlan,
                 nw_proto=inet.IPPROTO_ICMPV6,
                 icmpv6_type=icmpv6.ND_ROUTER_SOLICIT),
             priority=priority,
             inst=controller_and_flood))
     return ofmsgs
Example #2
0
 def add_faucet_vip(self, vlan, faucet_vip):
     ofmsgs = []
     max_prefixlen = faucet_vip.ip.max_prefixlen
     faucet_vip_host = self._host_from_faucet_vip(faucet_vip)
     priority = self.route_priority + max_prefixlen
     learn_connected_priority = self.route_priority + faucet_vip.network.prefixlen
     faucet_vip_host_nd_mcast = valve_packet.ipv6_link_eth_mcast(
         valve_packet.ipv6_solicited_node_from_ucast(faucet_vip.ip))
     ofmsgs.append(
         self.valve_flowmod(
             self.eth_src_table,
             self.valve_in_match(self.eth_src_table,
                                 eth_type=self.ETH_TYPE,
                                 vlan=vlan,
                                 nw_proto=inet.IPPROTO_ICMPV6,
                                 eth_dst=faucet_vip_host_nd_mcast,
                                 icmpv6_type=icmpv6.ND_NEIGHBOR_SOLICIT),
             priority=priority,
             inst=[
                 valve_of.apply_actions([valve_of.output_controller()]),
                 valve_of.goto_table(self.flood_table)
             ]))
     ofmsgs.append(
         self.valve_flowmod(
             self.eth_src_table,
             self.valve_in_match(self.eth_src_table,
                                 eth_type=self.ETH_TYPE,
                                 eth_dst=self.faucet_mac,
                                 vlan=vlan,
                                 nw_proto=inet.IPPROTO_ICMPV6,
                                 icmpv6_type=icmpv6.ND_NEIGHBOR_ADVERT),
             priority=priority,
             inst=[valve_of.apply_actions([valve_of.output_controller()])]))
     if faucet_vip.ip in valve_packet.IPV6_LINK_LOCAL:
         ofmsgs.append(
             self.valve_flowmod(
                 self.eth_src_table,
                 self.valve_in_match(
                     self.eth_src_table,
                     eth_type=self.ETH_TYPE,
                     vlan=vlan,
                     nw_proto=inet.IPPROTO_ICMPV6,
                     eth_dst=valve_packet.IPV6_ALL_ROUTERS_MCAST,
                     icmpv6_type=icmpv6.ND_ROUTER_SOLICIT),
                 priority=priority,
                 inst=[
                     valve_of.apply_actions([valve_of.output_controller()]),
                     valve_of.goto_table(self.flood_table)
                 ]))
     # Initialize IPv6 FIB
     ofmsgs.append(
         self.valve_flowmod(self.eth_src_table,
                            self.valve_in_match(self.eth_src_table,
                                                eth_type=self.ETH_TYPE,
                                                eth_dst=self.faucet_mac,
                                                vlan=vlan),
                            priority=self.route_priority,
                            inst=[valve_of.goto_table(self.fib_table)]))
     ofmsgs.append(
         self.valve_flowcontroller(
             self.fib_table,
             self.valve_in_match(self.fib_table,
                                 eth_type=self.ETH_TYPE,
                                 vlan=vlan,
                                 nw_proto=inet.IPPROTO_ICMPV6,
                                 nw_dst=faucet_vip_host,
                                 icmpv6_type=icmpv6.ICMPV6_ECHO_REQUEST),
             priority=priority,
             max_len=128))
     if self.proactive_learn:
         ofmsgs.append(
             self.valve_flowcontroller(self.fib_table,
                                       self.valve_in_match(
                                           self.fib_table,
                                           vlan=vlan,
                                           eth_type=self.ETH_TYPE,
                                           nw_dst=faucet_vip),
                                       priority=learn_connected_priority))
     return ofmsgs