[질문] Service null exception 및 미니넷 토폴로지와 connection 관련

44 views
Skip to first unread message

김병훈

unread,
Dec 9, 2014, 2:22:50 AM12/9/14
to open...@googlegroups.com

#1. 

iris를 이용해서 새로운 모듈을 정의하고
initialize() 함수 안에서 다른 서비스를 정의 내립니다.

protected void initialize() {

    ....

    deviceService = (IDeviceService) getModule(IDeviceService.class);
    topologyService = (ITopologyService) getModule(ITopologyService.class);

    deviceService.addListener(this);
    topologyService.addListener(this);


    ....

}

그런데 여러 스레드에서 동시에 여러모듈을 로드하는 일이 발생하면서 실행이 잘 될 때도 있는데, 문제가 발생할 경우 null pointer exception이 발생합니다.
deviceService.addListener(this); 할 때, OFMDeviceManager 내부에 정의된 Device devices 선언되지 않은상태에서 addlistener를 하면서 null pointer exception이 발생합니다.

다른 모듈을 참조해봐도 제가 구현한 방식과 동일하게 모듈의 서비스를 가져오고 있네요.

Exception in thread "main" java.lang.NullPointerException
at etri.sdn.controller.module.devicemanager.OFMDeviceManager.addListener(OFMDeviceManager.java:453)
at kr.ac.snu.mmlab.raonmanager.OFMRaonManager.initialize(OFMRaonManager.java:100)
at etri.sdn.controller.OFModule.start(OFModule.java:86)
at etri.sdn.controller.OFController.startModules(OFController.java:275)
at etri.sdn.controller.Main.controller_registration_loop(Main.java:182)
at etri.sdn.controller.Main.main(Main.java:86)







#2.

Mininet 을 이용해서 controller에 토폴로지를 정의하게 되면 다음과 같이 처음에 connect 되었다가 disconnect 되고 다시 connect가 진행됩니다.
( mn --topo=tree,2 --controller=remote )

2014-12-09 14:52:46,255]  INFO connected with /127.0.0.1:41087 (etri.sdn.controller.protocol.io.ClientChannelWatcher::handleConnectedEvent:176)
[2014-12-09 14:52:46,345]  INFO disconnected with /127.0.0.1:41087 (etri.sdn.controller.protocol.io.ClientChannelWatcher::handleDisconnectedEvent:211)
[2014-12-09 14:52:46,869]  INFO connected with /127.0.0.1:41088 (etri.sdn.controller.protocol.io.ClientChannelWatcher::handleConnectedEvent:176)
[2014-12-09 14:52:46,992]  INFO connected with /127.0.0.1:41089 (etri.sdn.controller.protocol.io.ClientChannelWatcher::handleConnectedEvent:176)
[2014-12-09 14:52:47,036]  INFO connected with /127.0.0.1:41090 (etri.sdn.controller.protocol.io.ClientChannelWatcher::handleConnectedEvent:176)

정상적으로 동작하고 있는건가요? 기존의 sample controller를 통해서 동일하게 시도했을 때도 동일한 결과를 보입니다.




정확한 이유는 알 수 없으나 직접 만든 미니넷 소스를 실행해서 controller에 연결했을 때 다음과 같은 메시지를 출력한 이후 메시지가 끝나게 됩니다.
2014-12-09 14:52:46,255]  INFO connected with /127.0.0.1:41087 (etri.sdn.controller.protocol.io.ClientChannelWatcher::handleConnectedEvent:176)
[2014-12-09 14:52:46,345]  INFO disconnected with /127.0.0.1:41087 (etri.sdn.controller.protocol.io.ClientChannelWatcher::handleDisconnectedEvent:211)

혹시 이와 관련된 부분은 뭐가 잘못된건가요?

제가 테스트한 소스는 다음과 같습니다.

def emptyNet():

    CONTROLLER_IP='localhost'

    net = Mininet( topo=None,
                   build=False)

    net.addController( 'c0',
                      controller=RemoteController,
                      ip=CONTROLLER_IP,
                      port=6633)

    h1 = net.addHost( 'h1', ip='10.0.0.1', mac='00:00:00:00:00:01' )
    h2 = net.addHost( 'h2', ip='10.0.0.2', mac='00:00:00:00:00:02' )
    h3 = net.addHost( 'h3', ip='10.0.0.3', mac='00:00:00:00:00:03' )
    h4 = net.addHost( 'h4', ip='10.0.0.4', mac='00:00:00:00:00:04' )
    h5 = net.addHost( 'h5', ip='10.0.0.5', mac='00:00:00:00:00:05' )
    s1 = net.addSwitch( 's1' )
    s2 = net.addSwitch( 's2' )
    net.addLink( h1, s1 )
    net.addLink( h2, s1 )
    net.addLink( h3, s1 )
    net.addLink( h4, s1 )
    net.addLink( h5, s1 )
    net.addLink( s1, s2 )
    net.start()

    CLI( net )
    net.stop()

if __name__ == '__main__':
    setLogLevel( 'info' )
    emptyNet()
Message has been deleted

Justin Park

unread,
Dec 9, 2014, 8:14:42 PM12/9/14
to open...@googlegroups.com
안녕하세요,

#1 새 모듈에 동기화 처리가 제대로 되지 않은것 같습니다.
전체 소스코드를 올리고(gitlab 또는 git 서버) 상황을 재연할 수 있도록 구성해주시고 알려주세요.
자세한 코드 없이 더이상 답변을 드리기는 어렵습니다. 

 #2 miniet은 컨트롤러가 있는지 확인하는 연결을 보냈다가 전체 토폴로지를 컨트롤러에 연결합니다. 
이거 인것 같은데 확인하시고 답변주세요. mininet discussion 그룹의 답변을 첨부합니다. 

to me, mininet-discuss
There are at least two things you can see here.

One is that Mininet tests to see if a controller is present before proceeding at some point.

Another is that with some versions of Open vSwitch, failed connections (from the switch trying to connect to the controller when the controller isn't there) don't seem to get entirely cleaned up.  I think I looked into the latter one at some point, but don't entirely remember what was up.  I actually changed how POX logged failed connections in order to not spam the log due to this case (this is probably only in POX dart).

-- Murphy

김병훈

unread,
Dec 16, 2014, 8:09:57 AM12/16/14
to open...@googlegroups.com
2번 질문에서 제가 올린 미니넷 스크립트의 ip를 지정할 때 localhost 로 지정해주니까 컨트롤러에서 알아보지 못하는 문제가 발생했네요.
127.0.0.1로 해결되었습니다.

2014년 12월 10일 수요일 오전 10시 14분 42초 UTC+9, Justin Park 님의 말:
Reply all
Reply to author
Forward
0 new messages