• No results found

Const Constructor ructor & D & Destruc estructor tor Docum Documentat entation ion

In document Mininet Python API Reference Manual (Page 45-51)

Additional Inherited MembersAdditional Inherited Members

5.12 minin mininet.no et.no de.Node de.Node Class Class Referen Referen ce ce

5.12.2 Const Constructor ructor & D & Destruc estructor tor Docum Documentat entation ion

5..112 2 mmiinniinneett..nnooddee..NNoodde e CCllaasss s RReeffeerreenncce e 3355

Public Attributes Public Attributes

•• namename

•• inNamespaceinNamespace

•• paramsparams

•• intfsintfs

•• portsports

•• nameToIntfnameToIntf

•• waitingwaiting

•• readbufreadbuf

•• shellshell

•• stdinstdin

•• stdoutstdout

•• pidpid

•• pollOutpollOut

•• execedexeced

•• lastCmdlastCmd

•• lastPidlastPid

Static Public Attributes Static Public Attributes

• inintt portBaseportBase = 0= 0

• dictidictionaryonary inToNodeinToNode = {}= {}

• dictidictionaryonary outToNodeoutToNode = {}= {}

•• isSetupisSetup = False= False

5.12.1

5.12.1 Detail Detailed ed Descrip Description tion

A virtual network node is simply a shell in a network namespace.

A virtual network node is simply a shell in a network namespace.

We communicate with it using pipes.

We communicate with it using pipes.

5.12.2

5.12.2 Const Constructor ructor & D & Destruc estructor tor Docum Documentat entation ion

5.1

5.12.22.2.1 .1 dedef f minminineinet.nt.nodode.Ne.Nodeode. . iniinit t (( selfself, , namname, e, inNainNamespmespace ace = = TrueTrue, , paparamrams s ))

Parameters Parameters

name 

name  name of nodename of node inNamespace 

inNamespace  in network namespace?in network namespace?

params 

params  NodeNodeparameters (seeparameters (see config()config()for details)for details)

5.12.3

5.12.3 Member Member Funct Function ion Docum Documentat entation ion

5.12.3.1

5.12.3.1 def def mininet.nodmininet.node.Node.addIne.Node.addIntf tf (( selself, f, intintf, f, poport rt = = NoneNone ))

Add an interface.

Add an interface.

Generated on Tue Jul 30 2013 16:44:09 for Mininet Python API Reference Manual by Doxygen Generated on Tue Jul 30 2013 16:44:09 for Mininet Python API Reference Manual by Doxygen

3

366 CCllaassssDDooccuummeennttaattiioonn

Parameters Parameters

intf 

intf  interfaceinterface port 

port  port number (optional, typically OpenFlow port number)port number (optional, typically OpenFlow port number)

5.12.3.2

5.12.3.2 def def mininet.nodmininet.node.Node.cleae.Node.cleanup nup (( self self ))

Help python collect its garbage.

Help python collect its garbage.

5.12.3.3

5.12.3.3 def def mininet.nodmininet.node.Node.cmd e.Node.cmd (( selfself, , argargs, s, kwarkwargs gs ))

Send a command, wait for output, and return it.

Send a command, wait for output, and return it.

Parameters Parameters

cmd 

cmd  stringstring

5.12.3.4

5.12.3.4 def def mininet.nodmininet.node.Node.cmdPe.Node.cmdPrint rint (( selfself, , argargs s ))

Call cmd and printing its output.

Call cmd and printing its output.

Parameters Parameters

cmd 

cmd  stringstring

5.12.3.5

5.12.3.5 def def mininet.nodmininet.node.Node.confie.Node.config g (( seself, lf, mamac c = = NoneNone, , iip p = = NoneNone, , defadefaultRultRoute oute = = NoneNone, , lo lo = = ’up’’up’, , papararams ms ))

Configure

Configure NodeNodeaccording to (optional)according to (optional)

Parameters Parameters

parameters  parameters  mac 

mac  MAC address for default interfaceMAC address for default interface ip 

ip  IP address for default interfaceIP address for default interface ifconfig 

ifconfig  arbarbitritraryary intinterferfaceace conconfigufiguratrationion SubSubclaclassessess shoshoulduld ovoverrierridede thithiss metmethodhod andand calcalll thethe parparentent claclass’ss’ss config(

config(

∗∗ ∗∗

params)params)

5.12.3.6

5.12.3.6 def def mininet.nodmininet.node.Node.conne.Node.connectionsTectionsTo o (( selfself, , nodnode e ))

Return [ intf1, intf2...

Return [ intf1, intf2...

] for all intfs that connect self to node.

] for all intfs that connect self to node.

5.12.3.7

5.12.3.7 def def mininet.nodmininet.node.Node.deletee.Node.deleteIntfs Intfs (( self, self, checkcheckName Name = = TrueTrue ))

Delete all of our interfaces.

Delete all of our interfaces.

5

5..112 2 mmiinniinneett..nnooddee..NNoodde e CCllaasss s RReeffeerreenncce e 3377

Parameters Parameters

checkName 

checkName  only delete interfaces that contain our nameonly delete interfaces that contain our name

5.12.3.8

5.12.3.8 def def mininet.nodmininet.node.Node.fdTe.Node.fdToNode oNode (( cclsls, , fd fd ))

Return node corresponding to given file descriptor.

Return node corresponding to given file descriptor.

Parameters Parameters

fd 

fd  file descriptorfile descriptor

Returns Returns

node node

5.12.3.9

5.12.3.9 def def mininet.nodmininet.node.Node.intf e.Node.intf (( selself, f, intintf f = = ’’’’ ))

Return our interface object with given string name, default intf if name is falsy (None, empty string, etc).

Return our interface object with given string name, default intf if name is falsy (None, empty string, etc).

or the input intf arg.

or the input intf arg.

Having this fcn return its arg for Intf objects makes it easier to construct functions with flexible input args for interfaces Having this fcn return its arg for Intf objects makes it easier to construct functions with flexible input args for interfaces (those that accept both string names and Intf objects).

(those that accept both string names and Intf objects).

5.12.3.10

5.12.3.10 def def mininet.nodmininet.node.Node.intfIsUp e.Node.intfIsUp (( seself, lf, intintf f = = NoneNone ))

Check if an interface is up.

Check if an interface is up.

5.12.3.11

5.12.3.11 def def mininet.nodmininet.node.Node.IP e.Node.IP (( selself, f, intintf f = = NoneNone ))

Return IP address of a node or specific interface.

Return IP address of a node or specific interface.

5.12.3.12

5.12.3.12 def def mininet.nodmininet.node.Node.MAC e.Node.MAC (( seself, lf, intintf f = = NoneNone ))

Return MAC address of a node or specific interface.

Return MAC address of a node or specific interface.

5.12.3.13

5.12.3.13 def def mininet.nodmininet.node.Node.monitor e.Node.monitor (( selfself, , timetimeoutmoutms s = = NoneNone ))

Monitor and return the output of a command.

Monitor and return the output of a command.

Set

Set selself.waf.waitiniting g to to FalsFalse e if if comcommand has mand has comcompletpleted.ed.

Parameters Parameters

timeoutms 

timeoutms  timeout in ms or None to wait indefinitely.timeout in ms or None to wait indefinitely.

Generated on Tue Jul 30 2013 16:44:09 for Mininet Python API Reference Manual by Doxygen Generated on Tue Jul 30 2013 16:44:09 for Mininet Python API Reference Manual by Doxygen

3

388 CCllaassssDDooccuummeennttaattiioonn

5.12.3.14

5.12.3.14 def def mininet.nodmininet.node.Node.newPe.Node.newPort ort (( self self ))

Return the next port number to allocate.

Return the next port number to allocate.

5.12.3.15

5.12.3.15 def def mininet.nodmininet.node.Node.pexe.Node.pexec ec (( selfself, , argargs, s, kwarkwargs gs ))

Execute a command using popen.

Execute a command using popen.

Returns Returns

out, err, exitcode out, err, exitcode

5.12.3.16

5.12.3.16 def def mininet.nodmininet.node.Node.popee.Node.popen n (( seself, lf, arargsgs, , kwakwargrgs s ))

Return a Popen() object in our namespace.

Return a Popen() object in our namespace.

Parameters Parameters

args 

args  Popen() args, single list, or stringPopen() args, single list, or string kwargs 

kwargs  Popen() keyword argsPopen() keyword args

5.12.3.17

5.12.3.17 def def mininet.nodmininet.node.Node.read e.Node.read (( selfself, , maxmaxbytbytes es = = 10241024 ))

Buffered read from node, non-blocking.

Buffered read from node, non-blocking.

Parameters Parameters

maxbytes 

maxbytes  maximum number of bytes to returnmaximum number of bytes to return

5.12.3.18

5.12.3.18 def def mininet.nodmininet.node.Node.readline e.Node.readline (( self self ))

Buffered readline from node, non-blocking.

Buffered readline from node, non-blocking.

Returns Returns

line (minus newline) or None line (minus newline) or None

5.12.3.19

5.12.3.19 def def mininet.nodmininet.node.Node.sende.Node.sendCmd Cmd (( selfself, , argargs, s, kwakwargs rgs ))

Send a command, followed by a command to echo a sentinel, and return without waiting for the command to complete.

Send a command, followed by a command to echo a sentinel, and return without waiting for the command to complete.

Parameters Parameters

args 

args  command and arguments, or stringcommand and arguments, or string printPid 

printPid  print command’s PID?print command’s PID?

5

5..112 2 mmiinniinneett..nnooddee..NNoodde e CCllaasss s RReeffeerreenncce e 3399

5.12.3.20

5.12.3.20 def def mininet.nodmininet.node.Node.sende.Node.sendInt Int (( seself, lf, sig sig = = signal.SIGINTsignal.SIGINT ))

Interrupt running command.

Interrupt running command.

5.12.3.21

5.12.3.21 def def mininet.nodmininet.node.Node.setARP e.Node.setARP (( seselflf, , ipip, , mamac c ))

Add an ARP entry.

Add an ARP entry.

Parameters Parameters

ip 

ip  IP address as stringIP address as string mac 

mac  MAC address as stringMAC address as string

5.12.3.22

5.12.3.22 def def mininet.nodmininet.node.Node.setDefae.Node.setDefaultRoute ultRoute (( seself, lf, intintf f = = NoneNone ))

Set the default route to go through intf.

Set the default route to go through intf.

Parameters Parameters

intf 

intf  Intf or {devIntf or {dev<<intfnameintfname>>viavia<<gw-ipgw-ip>>...}...}

5.12.3.23

5.12.3.23 def def mininet.nodmininet.node.Node.setHose.Node.setHostRoute tRoute (( seselflf, , ipip, , inintf tf ))

Add route to host.

Add route to host.

Parameters Parameters

ip 

ip  IP address as dotted decimalIP address as dotted decimal intf 

intf  string, interface namestring, interface name

5.12.3.24

5.12.3.24 def def mininet.nodmininet.node.Node.setIP e.Node.setIP (( seself, lf, ip, ip, preprefixLfixLen en = = 88, , inintf tf = = NoneNone ))

Set the IP address for an interface.

Set the IP address for an interface.

Parameters Parameters

intf 

intf  intf or intf nameintf or intf name ip 

ip  IP address as a IP address as a stringstring prefixLen 

prefixLen  prefix length, e.g. 8 for /8 or 16M addrsprefix length, e.g. 8 for /8 or 16M addrs

5.12.3.25

5.12.3.25 def def mininet.nodmininet.node.Node.setMAC e.Node.setMAC (( seself, lf, mamac, c, intintf f = = NoneNone ))

Set the MAC address for an interface.

Set the MAC address for an interface.

Parameters Parameters

intf 

intf  intf or intf nameintf or intf name mac 

mac  MAC address as stringMAC address as string

Generated on Tue Jul 30 2013 16:44:09 for Mininet Python API Reference Manual by Doxygen Generated on Tue Jul 30 2013 16:44:09 for Mininet Python API Reference Manual by Doxygen

4

400 CCllaassssDDooccuummeennttaattiioonn

5.12.3.26

5.12.3.26 def def mininet.nodmininet.node.Node.setPe.Node.setParam aram (( seself, lf, resresultults, s, memethothod, d, parparam am ))

Internal.

Internal.

Parameters Parameters

method 

method  configure aconfigure a single single parameterparameter results 

results  dict of results to updatedict of results to update method 

method  config method nameconfig method name param 

param  arg=value (ignore if value=None) value may also be list or dictarg=value (ignore if value=None) value may also be list or dict

5.12.3.27

5.12.3.27 def def mininet.nodmininet.node.Node.stop e.Node.stop (( self self ))

Stop node.

Stop node.

5.12.3.28

5.12.3.28 def def mininet.nodmininet.node.Node.terminate e.Node.terminate (( self self ))

Send kill signal to

Send kill signal to NodeNodeand clean up after it.and clean up after it.

5.12.3.29

5.12.3.29 def def mininet.nodmininet.node.Node.waitOutpe.Node.waitOutput ut (( selfself, , verbverbose ose = = FalseFalse ))

Wait for a command to complete.

Wait for a command to complete.

Com

Completpletion ion is is signsignaled aled by by a a sentsentinel inel chacharactracter, er, ASCIASCII(12I(127)7) ap

appeapeariring ng in in ththe e ououtputput t strstreameam. . WaWait it fofor r ththe e sesentintinenel l anand d rereturturnn the

the outoutput, put, incincludiluding ng traitrailing ling newlnewline.ine.

Parameters Parameters

verbose 

verbose  print output interactivelyprint output interactively

5.12.3.30

5.12.3.30 def def mininet.nodmininet.node.Node.waitReae.Node.waitReadable dable (( selfself, , timetimeoutmoutms s = = NoneNone ))

Wait until node’s output is readable.

Wait until node’s output is readable.

Parameters Parameters

timeoutms 

timeoutms  timeout in ms or None to wait indefinitely.timeout in ms or None to wait indefinitely.

5.12.3.31

5.12.3.31 def def mininet.nodmininet.node.Node.write e.Node.write (( seself, lf, dadata ta ))

Write data to node.

Write data to node.

Parameters Parameters

data 

data  stringstring

The documentation for this class was generated from the following file:

The documentation for this class was generated from the following file:

In document Mininet Python API Reference Manual (Page 45-51)

Related documents