diff options
-rw-r--r-- | src/VppContractManager.cpp | 86 | ||||
-rw-r--r-- | src/VppEndPointGroupManager.cpp | 20 | ||||
-rw-r--r-- | src/VppExtItfManager.cpp | 8 | ||||
-rw-r--r-- | src/VppManager.cpp | 2 | ||||
-rw-r--r-- | src/VppRenderer.cpp | 6 | ||||
-rw-r--r-- | src/VppRouteManager.cpp | 4 | ||||
-rw-r--r-- | src/include/VppContractManager.hpp | 9 | ||||
-rw-r--r-- | src/include/VppRouteManager.hpp | 4 | ||||
-rw-r--r-- | src/test/VppManager_test.cpp | 116 |
9 files changed, 156 insertions, 99 deletions
diff --git a/src/VppContractManager.cpp b/src/VppContractManager.cpp index 873e77d..5e5d20f 100644 --- a/src/VppContractManager.cpp +++ b/src/VppContractManager.cpp @@ -21,24 +21,26 @@ #include <vom/om.hpp> #include "VppContractManager.hpp" +#include "VppEndPointGroupManager.hpp" #include "VppLog.hpp" +#include "VppRuntime.hpp" using namespace VOM; namespace VPP { -ContractManager::ContractManager(opflexagent::Agent &agent, IdGen &id_gen) - : m_agent(agent) - , m_id_gen(id_gen) +ContractManager::ContractManager(Runtime &r) + : m_runtime(r) { } static void -get_group_sclass(opflexagent::Agent &agent, +get_group_sclass(Runtime &runtime, const std::unordered_set<opflex::modb::URI> &uris, - std::unordered_set<uint32_t> &ids) + std::vector<uint32_t> &ids) { - opflexagent::PolicyManager &pm = agent.getPolicyManager(); + opflexagent::PolicyManager &pm = runtime.policy_manager(); + for (auto &u : uris) { boost::optional<uint32_t> sclass = pm.getSclassForGroup(u); @@ -49,7 +51,7 @@ get_group_sclass(opflexagent::Agent &agent, } if (sclass) { - ids.insert(sclass.get()); + ids.push_back(sclass.get()); } else { @@ -58,6 +60,29 @@ get_group_sclass(opflexagent::Agent &agent, } } +static void +get_group_scope_sclass(Runtime &runtime, + const std::unordered_set<opflex::modb::URI> &uris, + std::vector<std::pair<uint16_t, uint32_t>> &ids) +{ + opflexagent::PolicyManager &pm = runtime.policy_manager(); + + for (auto &u : uris) + { + try + { + EndPointGroupManager::ForwardInfo fwd = + EndPointGroupManager::get_fwd_info(runtime, u); + + ids.push_back(std::make_pair(fwd.rdId, fwd.sclass)); + } + catch (EndPointGroupManager::NoFowardInfoException &e) + { + VLOGW << "No RD for: " << u; + } + } +} + static uint32_t getRdId(IdGen &id_gen, const std::shared_ptr<modelgbp::gbp::RoutingDomain> epgRd) @@ -94,7 +119,7 @@ ContractManager::handle_update(const opflex::modb::URI &uri) OM::mark_n_sweep ms(uuid); - opflexagent::PolicyManager &polMgr = m_agent.getPolicyManager(); + opflexagent::PolicyManager &polMgr = m_runtime.policy_manager(); if (!polMgr.contractExists(uri)) { // Contract removed @@ -108,12 +133,11 @@ ContractManager::handle_update(const opflex::modb::URI &uri) polMgr.getContractConsumers(uri, consURIs); polMgr.getContractIntra(uri, intraURIs); - typedef std::unordered_set<uint32_t> id_set_t; - id_set_t provIds; - id_set_t consIds; + std::vector<std::pair<uint16_t, uint32_t>> provIds; + std::vector<uint32_t> consIds; - get_group_sclass(m_agent, provURIs, provIds); - get_group_sclass(m_agent, consURIs, consIds); + get_group_scope_sclass(m_runtime, provURIs, provIds); + get_group_sclass(m_runtime, consURIs, consIds); opflexagent::PolicyManager::rule_list_t rules; polMgr.getContractRules(uri, rules); @@ -194,10 +218,11 @@ ContractManager::handle_update(const opflex::modb::URI &uri) uint8_t macAddr[6] = {0}; dst->getMac().toUIntArray(macAddr); mac_address_t mac(macAddr); - gbp_rule::next_hop_t nh(dst->getIp(), - mac, - getBdId(m_id_gen, dst->getBD()), - getRdId(m_id_gen, dst->getRD())); + gbp_rule::next_hop_t nh( + dst->getIp(), + mac, + getBdId(m_runtime.id_gen, dst->getBD()), + getRdId(m_runtime.id_gen, dst->getRD())); nhs.insert(nh); } if (nhs.size() == 0) @@ -249,22 +274,31 @@ ContractManager::handle_update(const opflex::modb::URI &uri) } } - for (const uint32_t &pvnid : provIds) + for (const auto pvnid : provIds) { for (const uint32_t &cvnid : consIds) { - if (pvnid == cvnid) /* intra group is allowed by default */ + if (pvnid.second == cvnid) /* intra group is allowed by default */ continue; - VLOGD << "Contract prov:" << pvnid << " cons:" << cvnid; + /* + * Derive the contract scope from the provider's RD + */ + VLOGD << "Contract prov:[" << pvnid.first << ", " << pvnid.second + << "]" + << " cons:" << cvnid; if (!in_rules.empty()) { ACL::l3_list inAcl(uuid + "in", in_rules); OM::write(uuid, inAcl); - gbp_contract gbpc_in( - pvnid, cvnid, inAcl, gbp_rules, in_ethertypes); + gbp_contract gbpc_in(pvnid.first, + pvnid.second, + cvnid, + inAcl, + gbp_rules, + in_ethertypes); OM::write(uuid, gbpc_in); } if (!out_rules.empty()) @@ -272,8 +306,12 @@ ContractManager::handle_update(const opflex::modb::URI &uri) ACL::l3_list outAcl(uuid + "out", out_rules); OM::write(uuid, outAcl); - gbp_contract gbpc_out( - cvnid, pvnid, outAcl, gbp_rules, out_ethertypes); + gbp_contract gbpc_out(pvnid.first, + cvnid, + pvnid.second, + outAcl, + gbp_rules, + out_ethertypes); OM::write(uuid, gbpc_out); } } diff --git a/src/VppEndPointGroupManager.cpp b/src/VppEndPointGroupManager.cpp index 38c3e27..e0cc81d 100644 --- a/src/VppEndPointGroupManager.cpp +++ b/src/VppEndPointGroupManager.cpp @@ -259,11 +259,11 @@ EndPointGroupManager::mk_gbp_rd(Runtime &r, vt_v4 = spine_proxy->mk_v4(key, vnid); vt_v6 = spine_proxy->mk_v6(key, vnid); - grd = std::make_shared<gbp_route_domain>(rd, vt_v4, vt_v6); + grd = std::make_shared<gbp_route_domain>(rd, rd.key(), vt_v4, vt_v6); } else { - grd = std::make_shared<gbp_route_domain>(rd); + grd = std::make_shared<gbp_route_domain>(rd, rd.key()); } OM::write(key, *grd); @@ -426,7 +426,7 @@ EndPointGroupManager::mk_group(Runtime &runtime, * construct a BD that uses the MAC spine proxy as the * UU-fwd interface */ - gbp_bridge_domain gbd(bd, bvi, vt_mac, vt_mc, gbd_flags); + gbp_bridge_domain gbd(bd, *grd, bvi, vt_mac, vt_mc, gbd_flags); OM::write(key, gbd); /* @@ -468,12 +468,13 @@ EndPointGroupManager::mk_group(Runtime &runtime, } OM::write(key, l2_upl); - gbp_bridge_domain gbd(bd, *bvi); - OM::write(key, gbd); - - gbp_route_domain grd(rd); + /* Use the generated RD ID as a unique scope */ + gbp_route_domain grd(rd, rd.key()); OM::write(key, grd); + gbp_bridge_domain gbd(bd, grd, *bvi); + OM::write(key, gbd); + gepg = std::make_shared<gbp_endpoint_group>( fwd.vnid, fwd.sclass, *encap_link, grd, gbd); } @@ -521,8 +522,7 @@ EndPointGroupManager::handle_update(const opflex::modb::URI &epgURI) std::shared_ptr<interface> bvi = gepg->get_bridge_domain()->get_bvi(); std::shared_ptr<bridge_domain> bd = gepg->get_bridge_domain()->get_bridge_domain(); - std::shared_ptr<route_domain> rd = - gepg->get_route_domain()->get_route_domain(); + std::shared_ptr<gbp_route_domain> grd = gepg->get_route_domain(); /* * The BVI is the NAT inside interface for the VMs @@ -573,7 +573,7 @@ EndPointGroupManager::handle_update(const opflex::modb::URI &epgURI) route::prefix_t pfx(sn->getAddress().get(), sn->getPrefixLen().get()); - gbp_subnet gs(*rd, + gbp_subnet gs(*grd, pfx.low(), (gepg->get_route_domain()->get_ip4_uu_fwd() ? gbp_subnet::type_t::TRANSPORT diff --git a/src/VppExtItfManager.cpp b/src/VppExtItfManager.cpp index eb8fa9b..82b2e8d 100644 --- a/src/VppExtItfManager.cpp +++ b/src/VppExtItfManager.cpp @@ -111,11 +111,11 @@ ExtItfManager::handle_update(const opflex::modb::URI &uri) /* * there's no leanring of EPs in an external BD */ - gbp_bridge_domain gbd( - bd, *bvi, {}, vt_mc, gbp_bridge_domain::flags_t::DO_NOT_LEARN); - OM::write(uuid, gbd); std::shared_ptr<VOM::gbp_route_domain> grd = EndPointGroupManager::mk_gbp_rd(m_runtime, uuid, rd, rd_vnid.get()); + gbp_bridge_domain gbd( + bd, *grd, *bvi, {}, vt_mc, gbp_bridge_domain::flags_t::DO_NOT_LEARN); + OM::write(uuid, gbd); /* * the encap on the external-interface is a vlan ID @@ -176,7 +176,7 @@ ExtItfManager::handle_update(const opflex::modb::URI &uri) return; } - RouteManager::mk_ext_nets(m_runtime, rd, uri, ext_dom.get()); + RouteManager::mk_ext_nets(m_runtime, *grd, uri, ext_dom.get()); } }; // namepsace VPP diff --git a/src/VppManager.cpp b/src/VppManager.cpp index 2040db4..98e93de 100644 --- a/src/VppManager.cpp +++ b/src/VppManager.cpp @@ -73,7 +73,7 @@ VppManager::start() m_epm = std::make_shared<EndPointManager>(m_runtime); m_epgm = std::make_shared<EndPointGroupManager>(m_runtime); m_sgm = std::make_shared<SecurityGroupManager>(m_runtime.agent); - m_cm = std::make_shared<ContractManager>(m_runtime.agent, m_runtime.id_gen); + m_cm = std::make_shared<ContractManager>(m_runtime); m_rdm = std::make_shared<RouteManager>(m_runtime); m_eim = std::make_shared<ExtItfManager>(m_runtime); diff --git a/src/VppRenderer.cpp b/src/VppRenderer.cpp index b892595..0dba4b2 100644 --- a/src/VppRenderer.cpp +++ b/src/VppRenderer.cpp @@ -300,10 +300,10 @@ VppRenderer::stop() vppManager->stop(); } -boost::asio::ip::address VppRenderer::getUplinkAddress() +boost::asio::ip::address +VppRenderer::getUplinkAddress() { - const boost::asio::ip::address addr = - vppManager->uplink().local_address(); + const boost::asio::ip::address addr = vppManager->uplink().local_address(); return addr; } diff --git a/src/VppRouteManager.cpp b/src/VppRouteManager.cpp index ad9c5ed..8f88c72 100644 --- a/src/VppRouteManager.cpp +++ b/src/VppRouteManager.cpp @@ -99,7 +99,7 @@ get_rd_subnets(opflexagent::Agent &agent, const opflex::modb::URI &uri) void RouteManager::mk_ext_nets( Runtime &runtime, - route_domain &rd, + gbp_route_domain &rd, const opflex::modb::URI &uri, std::shared_ptr<modelgbp::gbp::L3ExternalDomain> ext_dom) { @@ -233,7 +233,7 @@ RouteManager::handle_domain_update(const opflex::modb::URI &uri) for (std::shared_ptr<modelgbp::gbp::L3ExternalDomain> ext_dom : extDoms) { - mk_ext_nets(m_runtime, rd, uri, ext_dom); + mk_ext_nets(m_runtime, *v_grd, uri, ext_dom); } } diff --git a/src/include/VppContractManager.hpp b/src/include/VppContractManager.hpp index 9b9d002..2b76a4f 100644 --- a/src/include/VppContractManager.hpp +++ b/src/include/VppContractManager.hpp @@ -12,7 +12,7 @@ #include <opflexagent/Agent.h> -#include "VppIdGen.hpp" +#include "VppRuntime.hpp" #include <vom/acl_l3_rule.hpp> @@ -21,16 +21,15 @@ namespace VPP class ContractManager { public: - ContractManager(opflexagent::Agent &agent, IdGen &id_gen); + ContractManager(Runtime &r); void handle_update(const opflex::modb::URI &uri); private: /** - * Referene to the uber-agent + * Referene to runtime data. */ - opflexagent::Agent &m_agent; - IdGen &m_id_gen; + Runtime &m_runtime; }; extern void setParamUpdate(modelgbp::gbpe::L24Classifier &cls, diff --git a/src/include/VppRouteManager.hpp b/src/include/VppRouteManager.hpp index eadc3d8..9494d0f 100644 --- a/src/include/VppRouteManager.hpp +++ b/src/include/VppRouteManager.hpp @@ -14,7 +14,7 @@ #include <modelgbp/gbp/L3ExternalDomain.hpp> -#include <vom/route_domain.hpp> +#include <vom/gbp_route_domain.hpp> #include "VppRuntime.hpp" @@ -30,7 +30,7 @@ class RouteManager static void mk_ext_nets(Runtime &runtime, - route_domain &rd, + gbp_route_domain &rd, const opflex::modb::URI &uri, std::shared_ptr<modelgbp::gbp::L3ExternalDomain> ext_dom); diff --git a/src/test/VppManager_test.cpp b/src/test/VppManager_test.cpp index bdae4ba..937ec37 100644 --- a/src/test/VppManager_test.cpp +++ b/src/test/VppManager_test.cpp @@ -86,6 +86,7 @@ class MockCmdQ : public HW::cmd_q MockCmdQ() : handle(0) , m_mutex() + , m_cmds() { } ~MockCmdQ() @@ -236,9 +237,9 @@ print_obj(const T &obj, const std::string &s) } #define WAIT_FOR_MATCH(obj) \ - WAIT_FOR_ONFAIL(is_match(obj), 100, print_obj(obj, "Not Found: ")) + WAIT_FOR_ONFAIL(is_match(obj), 1000, print_obj(obj, "Not Found: ")) #define WAIT_FOR_NOT_PRESENT(obj) \ - WAIT_FOR_ONFAIL(!is_present(obj), 100, print_obj(obj, "Still present: ")) + WAIT_FOR_ONFAIL(!is_present(obj), 1000, print_obj(obj, "Still present: ")) class VppManagerFixture : public ModbFixture { @@ -749,11 +750,14 @@ BOOST_FIXTURE_TEST_CASE(endpoint_group_add_del, VppStitchedManagerFixture) WAIT_FOR_MATCH(v_upl_epg0); WAIT_FOR_MATCH(l2_binding(v_upl_epg0, v_bd_epg0)); - gbp_bridge_domain *v_gbd0 = new gbp_bridge_domain(v_bd_epg0, *v_bvi_epg0); + gbp_route_domain *v_grd0 = new gbp_route_domain(v_rd, 100); + WAIT_FOR_MATCH(*v_grd0); + gbp_bridge_domain *v_gbd0 = + new gbp_bridge_domain(v_bd_epg0, *v_grd0, *v_bvi_epg0); WAIT_FOR_MATCH(*v_gbd0); gbp_endpoint_group *v_epg0 = - new gbp_endpoint_group(0xA0A, 0xBA, v_upl_epg0, v_rd, *v_gbd0); + new gbp_endpoint_group(0xA0A, 0xBA, v_upl_epg0, *v_grd0, *v_gbd0); v_epg0->set({120}); WAIT_FOR_MATCH(*v_epg0); @@ -783,10 +787,10 @@ BOOST_FIXTURE_TEST_CASE(endpoint_group_add_del, VppStitchedManagerFixture) /* * there should be a route for each of those sub-nets via the epg-uplink */ - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("10.20.44.0"), 24}, gbp_subnet::type_t::STITCHED_INTERNAL)); - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("2001:db8::"), 32}, gbp_subnet::type_t::STITCHED_INTERNAL)); @@ -796,10 +800,10 @@ BOOST_FIXTURE_TEST_CASE(endpoint_group_add_del, VppStitchedManagerFixture) */ vppManager.domainUpdated(modelgbp::gbp::RoutingDomain::CLASS_ID, rd0->getURI()); - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("10.20.44.0"), 24}, gbp_subnet::type_t::STITCHED_INTERNAL)); - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("2001:db8::"), 32}, gbp_subnet::type_t::STITCHED_INTERNAL)); @@ -820,20 +824,21 @@ BOOST_FIXTURE_TEST_CASE(endpoint_group_add_del, VppStitchedManagerFixture) sub_interface v_upl_epg1(v_phy, interface::admin_state_t::UP, 0xA0B); WAIT_FOR_MATCH(v_upl_epg1); WAIT_FOR_MATCH(l2_binding(v_upl_epg1, v_bd_epg1)); - gbp_bridge_domain *v_gbd1 = new gbp_bridge_domain(v_bd_epg1, *v_bvi_epg1); + gbp_bridge_domain *v_gbd1 = + new gbp_bridge_domain(v_bd_epg1, *v_grd0, *v_bvi_epg1); WAIT_FOR_MATCH(*v_gbd1); gbp_endpoint_group *v_epg1 = - new gbp_endpoint_group(0xA0B, 0xB0B, v_upl_epg1, v_rd, *v_gbd1); + new gbp_endpoint_group(0xA0B, 0xB0B, v_upl_epg1, *v_grd0, *v_gbd1); v_epg1->set({120}); WAIT_FOR_MATCH(*v_epg1); - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("10.20.44.0"), 24}, gbp_subnet::type_t::STITCHED_INTERNAL)); - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("10.20.45.0"), 24}, gbp_subnet::type_t::STITCHED_INTERNAL)); - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("2001:db8::"), 32}, gbp_subnet::type_t::STITCHED_INTERNAL)); @@ -853,16 +858,16 @@ BOOST_FIXTURE_TEST_CASE(endpoint_group_add_del, VppStitchedManagerFixture) vppManager.domainUpdated(modelgbp::gbp::RoutingDomain::CLASS_ID, rd0->getURI()); - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("10.20.44.0"), 24}, gbp_subnet::type_t::STITCHED_INTERNAL)); - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("10.20.45.0"), 24}, gbp_subnet::type_t::STITCHED_INTERNAL)); - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("10.20.46.0"), 24}, gbp_subnet::type_t::STITCHED_INTERNAL)); - WAIT_FOR_MATCH(gbp_subnet(v_rd, + WAIT_FOR_MATCH(gbp_subnet(*v_grd0, {address::from_string("2001:db8::"), 32}, gbp_subnet::type_t::STITCHED_INTERNAL)); @@ -883,16 +888,16 @@ BOOST_FIXTURE_TEST_CASE(endpoint_group_add_del, VppStitchedManagerFixture) removeEpg(epg1); vppManager.egDomainUpdated(epg1->getURI()); - WAIT_FOR_NOT_PRESENT(gbp_subnet(v_rd, + WAIT_FOR_NOT_PRESENT(gbp_subnet(*v_grd0, {address::from_string("10.20.44.0"), 24}, gbp_subnet::type_t::STITCHED_INTERNAL)); - WAIT_FOR_NOT_PRESENT(gbp_subnet(v_rd, + WAIT_FOR_NOT_PRESENT(gbp_subnet(*v_grd0, {address::from_string("10.20.45.0"), 24}, gbp_subnet::type_t::STITCHED_INTERNAL)); - WAIT_FOR_NOT_PRESENT(gbp_subnet(v_rd, + WAIT_FOR_NOT_PRESENT(gbp_subnet(*v_grd0, {address::from_string("10.20.46.0"), 24}, gbp_subnet::type_t::STITCHED_INTERNAL)); - WAIT_FOR_NOT_PRESENT(gbp_subnet(v_rd, + WAIT_FOR_NOT_PRESENT(gbp_subnet(*v_grd0, {address::from_string("2001:db8::"), 32}, gbp_subnet::type_t::STITCHED_INTERNAL)); @@ -919,6 +924,8 @@ BOOST_FIXTURE_TEST_CASE(endpoint_group_add_del, VppStitchedManagerFixture) /* * If the RDs have gone we can be sure the routes have too. */ + WAIT_FOR_NOT_PRESENT(*v_grd0); + delete v_grd0; WAIT_FOR_NOT_PRESENT(v_upl_epg0); WAIT_FOR_NOT_PRESENT(v_bd_epg0); WAIT_FOR_NOT_PRESENT(v_upl_epg1); @@ -954,11 +961,15 @@ BOOST_FIXTURE_TEST_CASE(endpoint_add_del, VppStitchedManagerFixture) v_bvi_epg0->set(vMac); WAIT_FOR_MATCH(*v_bvi_epg0); - gbp_bridge_domain *v_gbd0 = new gbp_bridge_domain(v_bd_epg0, *v_bvi_epg0); + gbp_route_domain *v_grd0 = new gbp_route_domain(v_rd, 100); + WAIT_FOR_MATCH(*v_grd0); + + gbp_bridge_domain *v_gbd0 = + new gbp_bridge_domain(v_bd_epg0, *v_grd0, *v_bvi_epg0); WAIT_FOR_MATCH(*v_gbd0); gbp_endpoint_group *v_epg0 = - new gbp_endpoint_group(0xA0A, 0xBA, v_upl_epg0, v_rd, *v_gbd0); + new gbp_endpoint_group(0xA0A, 0xBA, v_upl_epg0, *v_grd0, *v_gbd0); v_epg0->set({120}); WAIT_FOR_MATCH(*v_epg0); @@ -997,10 +1008,11 @@ BOOST_FIXTURE_TEST_CASE(endpoint_add_del, VppStitchedManagerFixture) sub_interface v_upl_epg1(v_phy, interface::admin_state_t::UP, 0xA0B); WAIT_FOR_MATCH(v_upl_epg1); - gbp_bridge_domain *v_gbd1 = new gbp_bridge_domain(v_bd_epg1, *v_bvi_epg1); + gbp_bridge_domain *v_gbd1 = + new gbp_bridge_domain(v_bd_epg1, *v_grd0, *v_bvi_epg1); WAIT_FOR_MATCH(*v_gbd1); gbp_endpoint_group *v_epg1 = - new gbp_endpoint_group(0xA0B, 0xB0B, v_upl_epg1, v_rd, *v_gbd1); + new gbp_endpoint_group(0xA0B, 0xB0B, v_upl_epg1, *v_grd0, *v_gbd1); v_epg1->set({120}); WAIT_FOR_MATCH(*v_epg1); @@ -1102,6 +1114,8 @@ BOOST_FIXTURE_TEST_CASE(endpoint_add_del, VppStitchedManagerFixture) /* * if the RD has gone then so have all the rest of the routes. */ + WAIT_FOR_NOT_PRESENT(*v_grd0); + delete v_grd0; WAIT_FOR_NOT_PRESENT(v_bd_epg0); WAIT_FOR_NOT_PRESENT(v_bd_epg1); WAIT_FOR_NOT_PRESENT(v_rd); @@ -1178,11 +1192,11 @@ BOOST_FIXTURE_TEST_CASE(trans_endpoint_group_add_del, new vxlan_tunnel(host, spine_v6, 0xBB, vxlan_tunnel::mode_t::GBP_L2); WAIT_FOR_MATCH(*vt_v6); + gbp_route_domain *v_grd = new gbp_route_domain(v_rd, 100, *vt_v4, *vt_v6); + WAIT_FOR_MATCH(*v_grd); gbp_bridge_domain *v_gbd = - new gbp_bridge_domain(v_bd, *v_bvi, *vt_mac, *vt_mc); + new gbp_bridge_domain(v_bd, *v_grd, *v_bvi, *vt_mac, *vt_mc); WAIT_FOR_MATCH(*v_gbd); - gbp_route_domain *v_grd = new gbp_route_domain(v_rd, *vt_v4, *vt_v6); - WAIT_FOR_MATCH(*v_grd); gbp_endpoint_group *v_epg = new gbp_endpoint_group(0xA0A, 0xBA, *v_grd, *v_gbd); @@ -1214,8 +1228,8 @@ BOOST_FIXTURE_TEST_CASE(trans_endpoint_group_add_del, delete v_epg; WAIT_FOR_NOT_PRESENT(*v_gbd); - WAIT_FOR_NOT_PRESENT(*v_grd); delete v_gbd; + WAIT_FOR_NOT_PRESENT(*v_grd); delete v_grd; WAIT_FOR_NOT_PRESENT(*v_bvi); @@ -1256,7 +1270,6 @@ BOOST_FIXTURE_TEST_CASE(ext_itf, VppTransportManagerFixture) "bvi-100", interface::type_t::BVI, interface::admin_state_t::UP, v_rd); l2_address_t l2addr(mac_address_t("00:00:00:00:80:00")); v_bvi->set(l2addr); - WAIT_FOR_MATCH(*v_bvi); boost::asio::ip::address bd_mcast = @@ -1269,10 +1282,6 @@ BOOST_FIXTURE_TEST_CASE(ext_itf, VppTransportManagerFixture) WAIT_FOR_MATCH(igmp_b); WAIT_FOR_MATCH(igmp_listen(igmp_b, bd_mcast.to_v4())); - gbp_bridge_domain *v_gbd = - new gbp_bridge_domain(v_bd, v_bvi, {}, vt_bd_mcast); - WAIT_FOR_MATCH(*v_gbd); - vxlan_tunnel *vt_v4 = new vxlan_tunnel( host, spine_v4, 0x010203, vxlan_tunnel::mode_t::GBP_L2); WAIT_FOR_MATCH(*vt_v4); @@ -1280,17 +1289,21 @@ BOOST_FIXTURE_TEST_CASE(ext_itf, VppTransportManagerFixture) host, spine_v6, 0x010203, vxlan_tunnel::mode_t::GBP_L2); WAIT_FOR_MATCH(*vt_v6); - gbp_route_domain *v_grd = new gbp_route_domain(v_rd, *vt_v4, *vt_v6); + gbp_route_domain *v_grd = + new gbp_route_domain(v_rd, v_rd.key(), *vt_v4, *vt_v6); WAIT_FOR_MATCH(*v_grd); + gbp_bridge_domain *v_gbd = + new gbp_bridge_domain(v_bd, *v_grd, v_bvi, {}, vt_bd_mcast); + WAIT_FOR_MATCH(*v_gbd); /* 0x80000064 is the internally generated EPG-ID for each Ext-net */ gbp_ext_itf *v_ei = new gbp_ext_itf(*v_bvi, *v_gbd, *v_grd); WAIT_FOR_MATCH(*v_ei); - WAIT_FOR_MATCH(gbp_subnet(v_rd, {"105.0.0.0", 24}, 1234)); - WAIT_FOR_MATCH(gbp_subnet(v_rd, {"106.0.0.0", 24}, 1234)); - WAIT_FOR_MATCH(gbp_subnet(v_rd, {"107.0.0.0", 24}, 1235)); - WAIT_FOR_MATCH(gbp_subnet(v_rd, {"108.0.0.0", 24}, 1235)); + WAIT_FOR_MATCH(gbp_subnet(*v_grd, {"105.0.0.0", 24}, 1234)); + WAIT_FOR_MATCH(gbp_subnet(*v_grd, {"106.0.0.0", 24}, 1234)); + WAIT_FOR_MATCH(gbp_subnet(*v_grd, {"107.0.0.0", 24}, 1235)); + WAIT_FOR_MATCH(gbp_subnet(*v_grd, {"108.0.0.0", 24}, 1235)); /* Add an EP */ vppManager.externalEndpointUpdated(ext_ep0->getUUID()); @@ -1330,14 +1343,15 @@ BOOST_FIXTURE_TEST_CASE(ext_itf, VppTransportManagerFixture) delete v_ep; WAIT_FOR_NOT_PRESENT(*v_epg0); delete v_epg0; - WAIT_FOR_NOT_PRESENT(gbp_subnet(v_rd, {"108.0.0.0", 24}, 1235)); + WAIT_FOR_NOT_PRESENT(gbp_subnet(*v_grd, {"108.0.0.0", 24}, 1235)); WAIT_FOR_NOT_PRESENT(*v_ei); delete v_ei; - WAIT_FOR_NOT_PRESENT(*v_grd); WAIT_FOR_NOT_PRESENT(*v_gbd); - + delete v_gbd; + WAIT_FOR_NOT_PRESENT(*v_grd); delete v_grd; + delete vt_v4; delete vt_v6; } @@ -1638,10 +1652,14 @@ BOOST_FIXTURE_TEST_CASE(policy, VppStitchedManagerFixture) gbp_contract::ethertype_set_t allowed2 = {ethertype_t::IPV4, ethertype_t::ARP}; - WAIT_FOR1(is_match(gbp_contract(202, 186, outAcl2, grules2, allowed2))); - WAIT_FOR1(is_match(gbp_contract(202, 187, outAcl2, grules2, allowed2))); - WAIT_FOR1(is_match(gbp_contract(203, 186, outAcl2, grules2, allowed2))); - WAIT_FOR1(is_match(gbp_contract(203, 187, outAcl2, grules2, allowed2))); + WAIT_FOR1( + is_match(gbp_contract(100, 0xCA, 0xBA, outAcl2, grules2, allowed2))); + WAIT_FOR1( + is_match(gbp_contract(100, 0xCB, 0xB0B, outAcl2, grules2, allowed2))); + WAIT_FOR1( + is_match(gbp_contract(100, 0xCA, 0xBA, outAcl2, grules2, allowed2))); + WAIT_FOR1( + is_match(gbp_contract(100, 0xCB, 0xB0B, outAcl2, grules2, allowed2))); } BOOST_FIXTURE_TEST_CASE(policyPortRange, VppStitchedManagerFixture) @@ -1713,7 +1731,9 @@ BOOST_FIXTURE_TEST_CASE(policyPortRange, VppStitchedManagerFixture) gbp_contract::ethertype_set_t allowed = {ethertype_t::IPV4, ethertype_t::ARP}; - WAIT_FOR1(is_match(gbp_contract(187, 186, outAcl, grules, allowed))); + inspector.handle_input("all", std::cout); + WAIT_FOR1( + is_match(gbp_contract(100, 0xB0B, 0xBA, outAcl, grules, allowed))); } BOOST_FIXTURE_TEST_CASE(policyRedirect, VppTransportManagerFixture) @@ -1827,7 +1847,7 @@ BOOST_FIXTURE_TEST_CASE(policyRedirect, VppTransportManagerFixture) ACL::l3_list outAcl(con5->getURI().toString() + "out", rules1); WAIT_FOR_MATCH(outAcl); - gbp_contract gbpc(187, 186, outAcl, gbp_rules, e_rules); + gbp_contract gbpc(100, 0xB0B, 0xBA, outAcl, gbp_rules, e_rules); WAIT_FOR1(is_match(gbpc)); } |