Skip to content

Commit

Permalink
Merge pull request #3538 from anurag6/node_link
Browse files Browse the repository at this point in the history
Revert back to serialisable form of stack graph
  • Loading branch information
gizmoguy authored May 4, 2020
2 parents 33c7399 + 5a44b37 commit ebfadbf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion faucet/valve.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def _update_stack_link_state(self, ports, now, other_valves):
self.notify(
{'STACK_TOPO_CHANGE': {
'stack_root': valve.dp.stack_root_name,
'graph': valve.dp.stack_graph,
'graph': valve.dp.get_node_link_data(),
'dps': notify_dps
}})
break
Expand Down
26 changes: 26 additions & 0 deletions tests/integration/mininet_multidp_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import time
import networkx
import json

from mininet.log import error

Expand Down Expand Up @@ -1806,3 +1807,28 @@ def test_broadcast_loop(self):
self.assertEqual(
except_count, 1,
'Number of links detecting the broadcast ARP %s (!= 1)' % except_count)


class FaucetStackTopoChangeTest(FaucetMultiDPTest):
"""Test STACK_TOPO_CHANGE event structure"""

NUM_DPS = 3

def test_graph_object(self):
"""Parse event log and validate graph object in event."""
self.set_up(
stack=True, n_dps=self.NUM_DPS, n_tagged=self.NUM_HOSTS, switch_to_switch_links=2)
self._enable_event_log()
self.verify_stack_up()
stack_event_found = False
with open(self.event_log, 'r') as event_log_file:
for event_log_line in event_log_file.readlines():
event = json.loads(event_log_line.strip())
if 'STACK_TOPO_CHANGE' in event:
stack_event_found = True
graph = event.get('STACK_TOPO_CHANGE').get('graph')
self.assertTrue(graph)
nodeCount = len(graph.get('nodes'))
self.assertEqual(nodeCount, 3,
'Number of nodes in graph object is %s (!=3)' % nodeCount)
self.assertTrue(stack_event_found)

0 comments on commit ebfadbf

Please sign in to comment.