Update and rename MantenerFIFO to MantenerFIFO.md
[vsorcdistro/.git] / ryu / tools / topology_graphviz.py
1 #! /usr/bin/env python
2
3 # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
4 # Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #    http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 # implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18
19 # usage example:
20 # curl http://localhost:8080/v1.0/topology/links|./topology_graphviz.py|neato -Tx11
21
22 import json
23 import sys
24
25 j = sys.stdin.read()
26 l = json.loads(j)
27
28 print 'digraph {'
29 print 'node [shape=box]'
30 for d in l:
31     print '"%s" -> "%s";' % (d['src']['dpid'], d['dst']['dpid'])
32 print 'overlap=false'
33 print '}'