Fixes another Graph regression relative to NetworkX.
RipL broke because the NetworkX Graph object that was used previously
for topologies is an undirected graph:
>>> import networkx as nx
>>> g=nx.Graph()
>>> g.add_edge(0,1)
>>> g[1]
{0: {}}
>>> g[0]
{1: {}}
There is a separate DiGraph object in NetworkX for directed behavior.
The minimal replacement previously implemented DiGraph behavior.
>>> from mininet.topo import Graph
>>> g2=Graph()
>>> g2.add_edge(0,1)
>>> g2[0]
[1]
>>> g2[1]
[]
This commit restores undirected graph behavior.
Commit 65c35b65 'Remove networkx dependency' broke this line from RipL:
nodes = [n for n in self.g[name] if self.layer(n) == layer]
To work around this, RipL code would have to be changed to something
like this:
nodes = [n for n in self.g.data[name] if self.layer(n) == layer]
...which would use an internal variable, data.
It seems cleaner to add this one little feature from NetworkX Graph objects.
There are a bunch of these remaining, but I don't think the right course is
to 'fix' all of them to make pep8 happy, but instead to either change
the test in pep8 to consider that a continuation line may itself
be continued halfway, OR, to change the code in these lines to be more
readable by removing the need for all those nested continuations.
Personally, I find multiply-broken lines (aka nested continuations) really
hard to read.
For the moment, I've removed the ability to specify
a dict of options without using **. This is a slightly
unfortunate trade-off since it simplifies implementation
at the expense of making the API slightly less convenient
(if somewhat more consistent.)
This should be mostly cosmetic, but it causes switches to number
their ports consistently with OpenFlow 1.0, which starts at 1.
For older versions of OpenFlow, SWITCH_PORT_BASE may be set to zero.
If ripcord.dctopo imports properly, then include its topologies in the
list of available ones. Also replace topo.py with new generic
topologies and update paths.
Also remove all non-object-oriented legacy Mininet code and update
tests.
User-space compatibility is untested, but most of the code for it is
still in.