Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VRF implementation for dataplane #242

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions autotest/autotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ bool tAutotest::step_sleep(const YAML::Node& yamlStep)

bool tAutotest::step_rib_insert(const YAML::Node& yaml)
{
common::icp::rib_update::insert request = {"autotest", "default", YANET_RIB_PRIORITY_DEFAULT, {}};
common::icp::rib_update::insert request = {"autotest", YANET_RIB_VRF_DEFAULT, YANET_RIB_PRIORITY_DEFAULT, {}};
auto& [protocol, vrf, priority, attribute_tables] = request;

if (yaml["attribute"].IsDefined())
Expand Down Expand Up @@ -1094,7 +1094,7 @@ bool tAutotest::step_rib_insert(const YAML::Node& yaml)

bool tAutotest::step_rib_remove(const YAML::Node& yaml)
{
common::icp::rib_update::remove request = {"autotest", "default", YANET_RIB_PRIORITY_DEFAULT, {}};
common::icp::rib_update::remove request = {"autotest", YANET_RIB_VRF_DEFAULT, YANET_RIB_PRIORITY_DEFAULT, {}};
auto& [protocol, vrf, priority, tables] = request;

if (yaml["attribute"].IsDefined())
Expand Down Expand Up @@ -1523,7 +1523,7 @@ void tAutotest::convert_ipv4Update(const std::string& string)

for (const auto& nexthop : utils::split(nexthops, ' '))
{
common::icp::rib_update::insert request = {"autotest", "default", YANET_RIB_PRIORITY_DEFAULT, {}};
common::icp::rib_update::insert request = {"autotest", YANET_RIB_VRF_DEFAULT, YANET_RIB_PRIORITY_DEFAULT, {}};
std::get<3>(request)[attribute_default]["ipv4"][nexthop].emplace_back(prefix,
std::to_string(pathInformations_ipv4Update[prefix].size()),
std::vector<uint32_t>());
Expand All @@ -1539,7 +1539,7 @@ void tAutotest::convert_ipv4Remove(const std::string& string)
{
for (const auto& pathInformation : pathInformations_ipv4Update[string])
{
common::icp::rib_update::remove request = {"autotest", "default", YANET_RIB_PRIORITY_DEFAULT, {}};
common::icp::rib_update::remove request = {"autotest", YANET_RIB_VRF_DEFAULT, YANET_RIB_PRIORITY_DEFAULT, {}};
std::get<3>(request)[{}]["ipv4"].emplace_back(ip_prefix_t(string),
pathInformation,
std::vector<uint32_t>());
Expand All @@ -1566,7 +1566,7 @@ void tAutotest::convert_ipv4LabelledUpdate(const std::string& string)
std::vector<uint32_t> labels;
labels.emplace_back(std::stoll(label, nullptr, 0));

common::icp::rib_update::insert request = {"autotest", "default", YANET_RIB_PRIORITY_DEFAULT, {}};
common::icp::rib_update::insert request = {"autotest", YANET_RIB_VRF_DEFAULT, YANET_RIB_PRIORITY_DEFAULT, {}};
std::get<3>(request)[attribute_default]["ipv4 mpls"][nexthop].emplace_back(prefix,
std::to_string(pathInformations_ipv4LabelledUpdate[prefix].size()) + ":10001",
labels);
Expand All @@ -1585,7 +1585,7 @@ void tAutotest::convert_ipv4LabelledRemove(const std::string& string)

for (const auto& pathInformation : pathInformations_ipv4LabelledUpdate[string])
{
common::icp::rib_update::remove request = {"autotest", "default", YANET_RIB_PRIORITY_DEFAULT, {}};
common::icp::rib_update::remove request = {"autotest", YANET_RIB_VRF_DEFAULT, YANET_RIB_PRIORITY_DEFAULT, {}};
std::get<3>(request)[{}]["ipv4 mpls"].emplace_back(ip_prefix_t(string),
pathInformation,
labels);
Expand All @@ -1604,7 +1604,7 @@ void tAutotest::convert_ipv6Update(const std::string& string)

for (const auto& nexthop : utils::split(nexthops, ' '))
{
common::icp::rib_update::insert request = {"autotest", "default", YANET_RIB_PRIORITY_DEFAULT, {}};
common::icp::rib_update::insert request = {"autotest", YANET_RIB_VRF_DEFAULT, YANET_RIB_PRIORITY_DEFAULT, {}};
std::get<3>(request)[attribute_default]["ipv6"][nexthop].emplace_back(prefix,
nexthop,
std::vector<uint32_t>());
Expand All @@ -1627,7 +1627,7 @@ void tAutotest::convert_ipv6LabelledUpdate(const std::string& string)
std::vector<uint32_t> labels;
labels.emplace_back(std::stoll(label, nullptr, 0));

common::icp::rib_update::insert request = {"autotest", "default", YANET_RIB_PRIORITY_DEFAULT, {}};
common::icp::rib_update::insert request = {"autotest", YANET_RIB_VRF_DEFAULT, YANET_RIB_PRIORITY_DEFAULT, {}};
std::get<3>(request)[attribute_default]["ipv6 mpls"][nexthop].emplace_back(prefix,
label + ":10001", ///< @todo: nexthop_label
labels);
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
68 changes: 68 additions & 0 deletions autotest/units/001_one_port/078_vrf_route/autotest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
steps:
- cli:
- rib static insert default 0.0.0.0/0 200.0.10.1
- rib static insert default 1.0.0.0/24 200.0.20.1
- rib static insert default 2.0.0.0/24 200.0.40.1
- rib static insert red 0.0.0.0/0 200.0.30.1
- rib static insert red 1.0.0.0/24 200.0.10.1
- rib static insert red 2.0.0.0/24 200.0.20.1
- rib static insert white 1.0.0.0/24 200.0.40.1
- rib static insert white 1.0.0.16/28 200.0.10.1
- rib static insert white 1.0.0.16/30 200.0.20.1
- cli:
- rib static insert default ::/0 c0de::10:1
- rib static insert default 7e01::/64 c0de::20:1
- rib static insert default 7e02::/64 c0de::40:1
- rib static insert red ::/0 c0de::30:1
- rib static insert red 7e01::/64 c0de::10:1
- rib static insert red 7e02::/64 c0de::20:1
- rib static insert white 7e01::/64 c0de::40:1
- rib static insert white 7e01::/96 c0de::10:1
- rib static insert white 7e01::/128 c0de::20:1
- cli:
- rib prefixes

- sendPackets:
- port: kni0
send: 001-send.pcap
expect: 001-expect.pcap
- sendPackets:
- port: kni0
send: 002-send.pcap
expect: 002-expect.pcap

- cli:
- rib static remove default 1.0.0.0/24 200.0.20.1
- rib static remove red 0.0.0.0/0 200.0.30.1
- rib static remove white 1.0.0.16/30 200.0.20.1
- rib static remove default 7e01::/64 c0de::20:1
- rib static remove red ::/0 c0de::30:1
- rib static remove white 7e01::/128 c0de::20:1
- cli:
- rib prefixes

- sendPackets:
- port: kni0
send: 003-send.pcap
expect: 003-expect.pcap
- sendPackets:
- port: kni0
send: 004-send.pcap
expect: 004-expect.pcap

- cli:
- rib static remove default 0.0.0.0/0 200.0.10.1
- rib static remove default 2.0.0.0/24 200.0.40.1
- rib static remove red 1.0.0.0/24 200.0.10.1
- rib static remove red 2.0.0.0/24 200.0.20.1
- rib static remove white 1.0.0.0/24 200.0.40.1
- rib static remove white 1.0.0.16/28 200.0.10.1
- cli:
- rib static remove default ::/0 c0de::10:1
- rib static remove default 7e02::/64 c0de::40:1
- rib static remove red 7e01::/64 c0de::10:1
- rib static remove red 7e02::/64 c0de::20:1
- rib static remove white 7e01::/64 c0de::40:1
- rib static remove white 7e01::/96 c0de::10:1
- cli:
- rib prefixes
67 changes: 67 additions & 0 deletions autotest/units/001_one_port/078_vrf_route/controlplane.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"modules": {
"lp0.100": {
"type": "logicalPort",
"physicalPort": "kni0",
"vlanId": "100",
"macAddress": "00:11:22:33:44:55",
"nextModule": "route0"
},
"lp0.200": {
"type": "logicalPort",
"physicalPort": "kni0",
"vlanId": "200",
"macAddress": "00:11:22:33:44:55",
"nextModule": "route0"
},
"lp0.300": {
"type": "logicalPort",
"physicalPort": "kni0",
"vlanId": "300",
"macAddress": "00:11:22:33:44:55",
"nextModule": "route0",
"vrf": "red"
},
"lp0.400": {
"type": "logicalPort",
"physicalPort": "kni0",
"vlanId": "400",
"macAddress": "00:11:22:33:44:55",
"nextModule": "route0",
"vrf": "white"
},
"route0": {
"type": "route",
"interfaces": {
"kni0.100": {
"ipv4Prefix": "200.0.10.0/24",
"neighborIPv4Address": "200.0.10.1",
"neighborIPv6Address": "c0de::10:1",
"neighborMacAddress": "00:00:00:11:11:11",
"nextModule": "lp0.100"
},
"kni0.200": {
"ipv4Prefix": "200.0.20.0/24",
"neighborIPv4Address": "200.0.20.1",
"neighborIPv6Address": "c0de::20:1",
"neighborMacAddress": "00:00:00:22:22:22",
"nextModule": "lp0.200"
},
"kni0.300": {
"ipv4Prefix": "200.0.30.0/24",
"neighborIPv4Address": "200.0.30.1",
"neighborIPv6Address": "c0de::30:1",
"neighborMacAddress": "00:00:00:33:33:33",
"nextModule": "lp0.300"
},
"kni0.400": {
"ipv4Prefix": "200.0.40.0/24",
"neighborIPv4Address": "200.0.40.1",
"neighborIPv6Address": "c0de::40:1",
"neighborMacAddress": "00:00:00:44:44:44",
"nextModule": "lp0.400"
}
}
}
}
}
Loading
Loading