Hi Natasha,

I can use this, but I don't know the host ids. When I try to use 0 and
1, I just get empty list. How are these host ids related to the output
produced by dpctl?

Is there a simple way to dump the complete topology into a data
structure?

Thanks,
Pradeep

> -----Original Message-----
> From: Natasha Gude [mailto:[email protected]]
> Sent: Wednesday, October 14, 2009 6:22 PM
> To: Pradeep Padala
> Cc: Martin Casado; [email protected]
> Subject: Re: [nox-dev] make check fails "Import by filename is not
> supported"
> 
> Hi Pradeep,
> 
> pytopology has a method get_outlinks thats takes a source datapathid
> and destination datapathid, and returns a list of all of the port
> pairs that are connected.  This is defined in pytopology.i
> 
> For example:
> 
> if datapath 1's ports 5 and 6 are connected to datapath 2's ports 3
> and 4 respectively, you would have the following.
> 
> from nox.lib.netinet.netinet import create_datapathid_from_host
> 
> dp1 = create_datapathid_from_host(1)
> dp2 = create_datapathid_from_host(2)
> ports = pytop.get_outlinks(dp1, dp2)
> 
> where ports would be a list of PyLinkPorts of length 2, where
> PyLinkPorts is described in that pytopology.i file.  Particularly it
> would be the equivalent of [ (5, 3), (6, 4) ] , however it's actually
> a SWIG-ed out list, which needs to be iterated through using begin(),
> incr(), and end().
> 
> Hope that helps,
> Natasha
> 
> On Oct 14, 2009, at 5:56 PM, Pradeep Padala wrote:
> 
> > That works for me. I also looked at miscws/noxinfows.py, which seems
> > to
> > do some of the things I wanted.
> >
> > I am trying to modify noxinfows.py to return topology. I got a
handle
> > for pytopology with
> >
> >      self.pytop        = self.resolve(pytopology)
> >
> > Later, when the GET request comes, I am calling the function I wrote
> > below
> >
> >    def _get_nox_topology(self, request, arg):
> >        try:
> >            return simplejson.dumps(self.pytop.XXXXXXXXXXXXXXXXX)
> >        except Exception, e:
> >            return self.err(Failure(), request, "_get_topology",
> >                            "Could not retrieve topology")
> >
> > Now, I don't know how to access the pytopology functions
(XXXXXXXXXXXX
> > part). For example, the get_outlinks() function takes two arguments,
> > but
> > in the C++ file, I didn't find any comments on what to pass here.
> >
> > In the manual, there are just a few notes about the topology module,
> > grepping through the whole source tree, I didn't find any examples
of
> > using pytopology (may be I am missing something).
> >
> > Any help would be great.
> >
> > Thanks,
> > Pradeep

_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

Reply via email to