Skip to content
Snippets Groups Projects
Commit 6131cb30 authored by Kuang-Ching Wang's avatar Kuang-Ching Wang
Browse files

Merge pull request #333 from nilok/iofswitch-inet-addr

adding getInetAddress() as a function for IOFSwitch
parents a1c91a27 5a45437a
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
package net.floodlightcontroller.core; package net.floodlightcontroller.core;
import java.io.IOException; import java.io.IOException;
import java.net.SocketAddress;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -217,6 +218,12 @@ public interface IOFSwitch { ...@@ -217,6 +218,12 @@ public interface IOFSwitch {
*/ */
public String getStringId(); public String getStringId();
/**
* Get the IP Address for the switch
* @return the inet address
*/
public SocketAddress getInetAddress();
/** /**
* Retrieves attributes of this switch * Retrieves attributes of this switch
* @return * @return
......
...@@ -616,6 +616,7 @@ public class OFSwitchImpl implements IOFSwitch { ...@@ -616,6 +616,7 @@ public class OFSwitchImpl implements IOFSwitch {
* Get the IP Address for the switch * Get the IP Address for the switch
* @return the inet address * @return the inet address
*/ */
@Override
@JsonSerialize(using=ToStringSerializer.class) @JsonSerialize(using=ToStringSerializer.class)
public SocketAddress getInetAddress() { public SocketAddress getInetAddress() {
return channel.getRemoteAddress(); return channel.getRemoteAddress();
......
...@@ -2,6 +2,7 @@ package net.floodlightcontroller.util; ...@@ -2,6 +2,7 @@ package net.floodlightcontroller.util;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import java.io.IOException; import java.io.IOException;
import java.net.SocketAddress;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
...@@ -191,6 +192,12 @@ public class OFMessageDamperMockSwitch implements IOFSwitch { ...@@ -191,6 +192,12 @@ public class OFMessageDamperMockSwitch implements IOFSwitch {
return null; return null;
} }
@Override
public SocketAddress getInetAddress() {
assertTrue("Unexpected method call", false);
return null;
}
@Override @Override
public Map<Object, Object> getAttributes() { public Map<Object, Object> getAttributes() {
assertTrue("Unexpected method call", false); assertTrue("Unexpected method call", false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment