I cheated controllers={'c%i' % domaine: self.addController('c%i' % domaine) 
for domaine in C}
not   
controllers={'c%i' % domaine: self.addHost('h%i' % domaine) for domaine in C}

    On Tuesday, January 8, 2019, 1:15:52 PM GMT+1, Imen Souidene via Ryu-devel 
<ryu-devel@lists.sourceforge.net> wrote:  
 
  Hi, I tried to add 3 ryu controllers for differents names.

1- Execute 3 controllers  :The customized module is written in: VICN.py (6633) 
/  VICN1.py (6634)  and  VICN2.py (6636)

  I opened 3 terminals to start 3 ryucontrollers:

sudo ryu-manager --ofp-tcp-listen-port VICN.py  ryu.app.ofctl_rest 
--observe-links
 sudo ryu-manager --ofp-tcp-listen-port VICN1.py  ryu.app.ofctl_rest 
--observe-links
 sudo ryu-manager --ofp-tcp-listen-port VICN2.py  ryu.app.ofctl_rest 
--observe-links

2- Execute mininet    (the customized topology is determind in VICN.py)
   -sudo mn --custom topology.py --controller=remote  
--switch=ovsk,protocols=OpenFlow14 --topo mytopo --mac --arp 
--link=tc,bw=1,delay=10ms
But the problem that the three controllers are displayed with the same name C0 
, despite each of the controllers running.
topology.py : 

from mininet.topo import Topo
from mininet.net import    Mininet            
from mininet.log import setLogLevel
from mininet.node import OVSSwitch, RemoteController
from mininet.link import TCLink , CLI

class ICNSDNTopology(Topo):
    "Simple topology example."

    def __init__(self):
        "Create custom topo."

        # Initialize topology
        Topo.__init__(self)

        H = [1, 2, 3,4,6,8]
        S = [1, 2, 3,4,5,6,7,8,9]
        P = [44,66,88]        C = [0,1,2]


        S = xrange(1, 10)

        

        switches = {'s%i' % domaine: self.addSwitch('s%i' % domaine) for 
domaine in S}

        hosts = {'h%i' % domaine: self.addHost('h%i' % domaine) for domaine in 
H}
        publishers = {'h%i' % domaine: self.addHost('h%i' % domaine) for 
domaine in P}
        controllers={'c%i' % domaine: self.addHost('h%i' % domaine) for domaine 
in C}

        # Merge(combine) switches and hosts
        nodes = {}
        nodes.update(switches)
        nodes.update(hosts)
        nodes.update(publishers)
        # Add a host service for each switch
        host_services = {'sh%i' % domaine: self.addHost('sh%i' % domaine) for 
domaine in H}
        nodes.update(host_services)
        links = [('s1','s2'), ('s2','s3'),('s3', 's4'), ('s4', 's5'), ('s3', 
's5'),('s6','s7'),
                 ('s7','s8'), 
('s1','s8'),('s8','s9'),('s9','s5'),('s3','s9'),('s2','s8'),
                  
('h2','s2'),('h1','s1'),('h4','s4'),('h6','s6'),('h8','s8'),('h3','s3'),
                    ('h44','s4'),('h66','s6'),('h88','s8')] # ('s5', 's6'),

        
        for link in links:
            self.addLink(nodes[link[0]], nodes[link[1]],bw=100, delay='10ms')
        # Add link between each switch and its corresponding service host
        for domaine in H:
            self.addLink(nodes['s%i' % domaine], host_services['sh%i' % 
domaine], 100,100,bw=100,delay='1ms')
            self.addLink(nodes['s%i' % domaine], host_services['sh%i' % 
domaine], 101,101,bw=100,delay='1ms')
            
        self.publishers = {'sh4','sh6'}    
        
topos = {'mytopo': (lambda: ICNSDNTopology())}

def runExperiment(hosts,publishers):            
    "Create and    test a simple    experiment"            
    topo_icn = ICNSDNTopology()            //Topology//
    net    = Mininet(switch=OVSSwitch(protocols="OpenFlow14"), topo=topo_icn) 

   controllers = []
 controllers = []

    c0 = RemoteController('c0', '10.0.20.3', 6633)
    c1 = RemoteController('c1', '10.1.2.1', 6634)
    c2 = RemoteController('c2', '10.128.3.1', 6635)

    controllers.append(c0)
    controllers.append(c1)
    controllers.append(c2)

    net.addController(c0)
    net.addController(c1)
    net.addController(c2)    

     for domain in range(0, 3):
            switches[domain * 3 + 0].start([controllers[domain]])
            switches[domain * 3 + 1].start([controllers[domain]])
            switches[domain * 3 + 2].start([controllers[domain]])
            switches[domain * 3 + 3].start([controllers[domain]])

net.build() c0.start()
c1.start()
c2.start()
 CLI(net)
  net.stop() 

----------------------------------------------

VICN.py :
from __future__ import print_function
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.lib.packet import packet
from ryu.lib.packet import ethernet, ipv4, mpls
from ryu.lib.packet import ether_types
from ryu.topology import event
from ryu.topology.api import get_switch, get_link
import networkx as nx
import os
import re
from registration import Registration
from ryu.ofproto import ofproto_v1_4
import threading
import time

class ICSDNController(app_manager.RyuApp):
    OFP_VERSIONS = [ofproto_v1_4.OFP_VERSION]

 def __init__(self, *args, **kwargs):
        super(ICSDNController, self).__init__(*args, **kwargs)              
//Topology//
        self.switches = []
        self.links = []
        self.mac_to_port = {}
        self.topology_api_app = self
        self.net = nx.DiGraph()  # Directional graph to set output_port
        self.INTEREST_PROTOCOL = 150
        self.DATA_PROTOCOL = 151
        self.REGISTER_PROTOCOL = 152
        self.HELLO_LABEL = 932620
        f = os.system('ifconfig > ifconfig')
        f = open('ifconfig', 'r+').read()
        # f = open('/proc/net/arp', 'r').read()sc
        mac_regex = re.compile("(?:[0-9a-fA-F]:?){12}")
        self.CONTROLLER_ETH = mac_regex.findall(f)[0]


Please, how can I solve it? 

_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel
  
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to