7 #include "vr_nexthop.h"
8 #include <net/ethernet.h>
9 #include <netinet/if_ether.h>
16 vr_nexthop_req &req,
int id)
21 req.set_h_op(sandesh_op::GET);
23 req.set_h_op(sandesh_op::DUMP);
24 req.set_nhr_marker(-1);
31 req.set_h_op(sandesh_op::DUMP);
33 req.set_nhr_marker(idx);
66 unsigned short type = nh_type;
88 unsigned family = nh_family;
100 unsigned family = nh_family;
114 vector<signed char>::const_iterator it = encap.begin();
115 strm << hex << setfill(
'0');
116 while(it != encap.end()) {
117 ubyte = (uint8_t) *it;
118 strm << setw(2) << (int)ubyte;
125 string flag_str, policy_str(
"POLICY "), gre_str(
"TUNNEL_GRE ");
126 string fabric_multicast(
"FABRIC_MULTICAST");
127 string l2_multicast(
"L2_MULTICAST");
128 string l3_multicast(
"L3_MULTICAST");
129 string multi_proto_multicast(
"MULTI_PROTO_MULTICAST");
131 string multicast_encap(
"MULTICAST_ENCAP");
132 string mpls_udp_str(
"TUNNEL_MPLS_UDP ");
133 string udp_str(
"TUNNEL_UDP "), sip_copy(
"TUNNEL_SIP_COPY ");
134 bool assigned =
false;
136 if (flags & NH_FLAG_VALID) {
137 flag_str.assign(
"VALID ");
140 if (flags & NH_FLAG_POLICY_ENABLED) {
142 flag_str.append(
"| " + policy_str);
144 flag_str.assign(policy_str);
148 if (flags & NH_FLAG_TUNNEL_GRE) {
150 flag_str.append(
"| " + gre_str);
152 flag_str.assign(gre_str);
156 if (flags & NH_FLAG_TUNNEL_UDP) {
158 flag_str.append(
"| " + udp_str);
160 flag_str.assign(udp_str);
164 if (flags & NH_FLAG_TUNNEL_UDP_MPLS) {
166 flag_str.append(
"| " + mpls_udp_str);
168 flag_str.assign(mpls_udp_str);
173 if (flags & NH_FLAG_COMPOSITE_ECMP) {
175 flag_str.append(
"| " + ecmp);
177 flag_str.assign(ecmp);
182 if (flags & NH_FLAG_COMPOSITE_FABRIC) {
184 flag_str.append(
"| " + fabric_multicast);
186 flag_str.assign(fabric_multicast);
191 if (flags & NH_FLAG_TUNNEL_SIP_COPY) {
193 flag_str.append(
"| " + sip_copy);
195 flag_str.assign(sip_copy);
207 std::vector<KComponentNH> comp_nh_list;
208 KComponentNH comp_nh;
210 if (req->get_nhr_type() != NH_COMPOSITE) {
214 const std::vector<int32_t> nh_list = req->get_nhr_nh_list();
215 const std::vector<int32_t> label_list = req->get_nhr_label_list();
217 for (uint32_t i = 0; i < nh_list.size(); i++) {
218 comp_nh.set_nh_id(nh_list[i]);
219 comp_nh.set_label(label_list[i]);
220 comp_nh_list.push_back(comp_nh);
222 info.set_component_nh(comp_nh_list);
const std::string EncapToString(const std::vector< signed char > &encap) const
std::string response_context_
const std::string FamilyToString(int family) const
const std::string EncapFamilyToString(int family) const
virtual void SendResponse()
Sandesh * response_object_
const std::string TypeToString(int type) const
NHKState(KNHResp *obj, const std::string &resp_ctx, vr_nexthop_req &encoder, int id)
virtual void SendNextRequest()
const std::string FlagsToString(uint32_t flags) const
void EncodeAndSend(Sandesh &encoder)
void SetComponentNH(vr_nexthop_req *req, KNHInfo &info)