Skip to content

Comments

Add DAQClient and basic test to simulate access switch with device coupler#936

Merged
anurag6 merged 35 commits intofaucetsdn:masterfrom
anurag6:daq_client
Dec 22, 2021
Merged

Add DAQClient and basic test to simulate access switch with device coupler#936
anurag6 merged 35 commits intofaucetsdn:masterfrom
anurag6:daq_client

Conversation

@anurag6
Copy link
Collaborator

@anurag6 anurag6 commented Dec 14, 2021

No description provided.

@anurag6 anurag6 requested a review from grafnu December 14, 2021 18:48
@anurag6 anurag6 marked this pull request as draft December 14, 2021 18:49
@@ -0,0 +1,9 @@
#!/bin/bash -e
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably just "build_device_coupler" to keep it a bit more generic and also similar to other uses (so not dev)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@@ -0,0 +1,15 @@
#!/bin/bash -e
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise: bin/start_device_coupler

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@@ -0,0 +1,18 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this for? The coupler should be a drop-in functional replacement for other switch implementations... why a separate setup config?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just something I am using to test for now. Will get rid of it.

@codecov
Copy link

codecov bot commented Dec 14, 2021

Codecov Report

Merging #936 (dfeedb6) into master (f00ba6e) will decrease coverage by 0.06%.
The diff coverage is 28.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #936      +/-   ##
==========================================
- Coverage   82.53%   82.47%   -0.07%     
==========================================
  Files          45       45              
  Lines        5693     5701       +8     
==========================================
+ Hits         4699     4702       +3     
- Misses        994      999       +5     
Flag Coverage Δ
ata 62.98% <28.57%> (-0.15%) ⬇️
aux 67.81% <28.57%> (-0.05%) ⬇️
base 65.97% <28.57%> (-0.08%) ⬇️
dhcp 67.08% <28.57%> (-0.05%) ⬇️
many 67.03% <28.57%> (+0.20%) ⬆️
mud 71.78% <28.57%> (-0.05%) ⬇️
switch 67.37% <28.57%> (-0.07%) ⬇️
topo 66.20% <28.57%> (-0.05%) ⬇️
unit 32.87% <14.28%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
daq/runner.py 85.86% <0.00%> (ø)
daq/topology.py 95.28% <33.33%> (-0.74%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f00ba6e...dfeedb6. Read the comment docs.

@@ -0,0 +1,121 @@
"""Server to handle incoming session requests"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the comment isn't updated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Ack.

Copy link
Collaborator

@grafnu grafnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how is this being tested (or is it) in CI? I don't see any testing changes so I'm assuming there's something missing there as well...

@anurag6 anurag6 marked this pull request as ready for review December 15, 2021 23:19
@anurag6
Copy link
Collaborator Author

anurag6 commented Dec 15, 2021

Reference

Added a CI test

@@ -0,0 +1,9 @@
#!/bin/bash -e
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have everything separate from the existing daq images build, testing, logging etc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea I am going for is a separate entity that can be integrated easily enough into DAQ. The logging can be merged fairly easily by using daq.utils instead. For now the idea is to get a test_device_coupler running separately like test_shunt that successfully runs the tests in test_aux and gets the same results. The config, logging and testing merging with DAQ is the next step

device = self._devices.create_if_absent(request.device_mac)
device.port.flapping_start = None # In case this was set from last disconnect.
device.dhcp_mode = DhcpMode.EXTERNAL
device.dhcp_mode = DhcpMode.EXTERNAL if request.assigned_vlan else DhcpMode.NORMAL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's probably worthwhile to leave a comment here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

daq/topology.py Outdated
acls[self.INCOMING_ACL_FORMAT % self.sec_name] = secondary_acl

acls[self.INCOMING_ACL_FORMAT % 'vxlan'] = [self._make_acl_rule(ports=[1])]
acls[self.INCOMING_ACL_FORMAT % 'vxlan_coupler'] = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe vxlan and vxlan_coupler can be converted to constants here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

CONNECT_TIMEOUT_SEC = 60


# pylint: disable=too-many-arguments
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this disable still necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


def create_vxlan_endpoint(self, port, remote_ip, vni, local_ip=None):
def _set_interface_up(self, interface, no_raise=False):
if no_raise:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified to
fn = self. _run_shell_no_raise if no_raise else self. _run_shell
fn('sudo ip link set %s up' % interface)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also no_raise with default False can also be simplified to raise=True

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

iface = "faux-%s" % index
ovs_helper.add_iface_to_bridge(bridge, iface)
ovs_helper.set_native_vlan(iface, 200 + index * 10)
ovs_helper.set_native_vlan(iface, 200 + (index % 3) * 10)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why index % 3 here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remnant from prev testing. Removed.

@anurag6 anurag6 merged commit 9659eb3 into faucetsdn:master Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants