<commit_before>#!/usr/bin/python

"""
This example shows how to create an empty Mininet() object 
(without a topology object) and add nodes to it manually.
"""

from mininet.net import Mininet
from mininet.node import Controller
from mininet.cli import CLI
from mininet.log import setLogLevel

def emptyNet():

    "Create an empty network and add nodes to it."
    
    net = Mininet( controller=Controller )

    print "*** Adding controller"
    c0 = net.addController( 'c0' )
    
    print "*** Adding hosts"
    h1 = net.addHost( 'h1', ip='10.0.0.1' )
    h2 = net.addHost( 'h2', ip='10.0.0.2' )
    
    print "*** Adding switch"
    s3 = net.addSwitch( 's3' )
    
    print "*** Creating links"
    h1.linkTo( s3 )
    h2.linkTo( s3 )
    
    print "*** Starting network"
    net.build()
    net.start()
    
    print "*** Running CLI"
    setLogLevel( 'info' )
    CLI( net )
    
    print "*** Stopping network"
    net.stop()
    
if __name__ == '__main__':
    emptyNet()<commit_msg>Changed to use info() and not call build() unnecessarily.<commit_after>#!/usr/bin/python

"""
This example shows how to create an empty Mininet() object 
(without a topology object) and add nodes to it manually.
"""

from mininet.net import Mininet
from mininet.node import Controller
from mininet.cli import CLI
from mininet.log import setLogLevel, info

def emptyNet():

    "Create an empty network and add nodes to it."
    
    net = Mininet( controller=Controller )

    info( '*** Adding controller\n' )
    c0 = net.addController( 'c0' )
    
    info( '*** Adding hosts\n' )
    h1 = net.addHost( 'h1', ip='10.0.0.1' )
    h2 = net.addHost( 'h2', ip='10.0.0.2' )
    
    info( '*** Adding switch\n' )
    s3 = net.addSwitch( 's3' )
    
    info( '*** Creating links\n' )
    h1.linkTo( s3 )
    h2.linkTo( s3 )
    
    info( '*** Starting network\n')
    net.start()
    
    info( '*** Running CLI\n' )
    CLI( net )
    
    info( '*** Stopping network' )
    net.stop()
    
if __name__ == '__main__':
    setLogLevel( 'info' )
    emptyNet()
{'fraction_non_alphanumeric': 0.14146815751093825, 'fraction_numerical': 0.0213903743315508, 'mean_word_length': 2.5916230366492146, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '470271', 'n_tokens_mistral': 738, 'n_tokens_neox': 711, 'n_words': 209}