summaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo/punt_dpo.h
blob: 370547c1596425013c4879fffc64562deb4a2adb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright (c) 2016 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @brief A DPO to punt packets to the Control-plane
 */

#ifndef __PUNT_DPO_H__
#define __PUNT_DPO_H__

#include <vnet/dpo/dpo.h>

extern int dpo_is_punt(const dpo_id_t *dpo);

extern const dpo_id_t *punt_dpo_get(dpo_proto_t proto);

extern void punt_dpo_module_init(void);

#endif
lass="n">mac=None): ip_addr = ip_address(text_type(nbr_addr)) e = VppEnum.vl_api_ip_neighbor_flags_t nbrs = test.vapi.ip_neighbor_dump(sw_if_index, is_ipv6=(6 == ip_addr.version)) for n in nbrs: if ip_addr == n.neighbor.ip_address and \ is_static == (n.neighbor.flags & e.IP_API_NEIGHBOR_FLAG_STATIC): if mac: if mac == str(n.neighbor.mac_address): return True else: return True return False class VppNeighbor(VppObject): """ ARP Entry """ def __init__(self, test, sw_if_index, mac_addr, nbr_addr, is_static=False, is_no_fib_entry=False): self._test = test self.sw_if_index = sw_if_index self.mac_addr = mac_addr self.nbr_addr = nbr_addr e = VppEnum.vl_api_ip_neighbor_flags_t self.flags = e.IP_API_NEIGHBOR_FLAG_NONE if is_static: self.flags |= e.IP_API_NEIGHBOR_FLAG_STATIC if is_no_fib_entry: self.flags |= e.IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY def add_vpp_config(self): r = self._test.vapi.ip_neighbor_add_del( self.sw_if_index, self.mac_addr, self.nbr_addr, is_add=1, flags=self.flags) self.stats_index = r.stats_index self._test.registry.register(self, self._test.logger) def remove_vpp_config(self): self._test.vapi.ip_neighbor_add_del( self.sw_if_index, self.mac_addr, self.nbr_addr, is_add=0, flags=self.flags) def is_static(self): e = VppEnum.vl_api_ip_neighbor_flags_t return (self.flags & e.IP_API_NEIGHBOR_FLAG_STATIC) def query_vpp_config(self): return find_nbr(self._test, self.sw_if_index, self.nbr_addr, self.is_static()) def object_id(self): return ("%d:%s" % (self.sw_if_index, self.nbr_addr)) def get_stats(self): c = self._test.statistics.get_counter("/net/adjacency") return c[0][self.stats_index]