use of org.onosproject.incubator.net.virtual.NetworkId in project onos by opennetworkinglab.
the class OFSwitchListCommand method doExecute.
@Override
protected void doExecute() {
OFSwitchService service = get(OFSwitchService.class);
Set<OFSwitch> ofSwitches;
if (networkId != NetworkId.NONE.id()) {
ofSwitches = service.ofSwitches(NetworkId.networkId(networkId));
} else {
ofSwitches = service.ofSwitches();
}
print(FORMAT, "DPID", "Connected controllers");
ofSwitches.forEach(ofSwitch -> {
Set<String> channels = ofSwitch.controllerChannels().stream().map(channel -> channel.remoteAddress().toString()).collect(Collectors.toSet());
print(FORMAT, ofSwitch.dpid(), channels);
});
}
use of org.onosproject.incubator.net.virtual.NetworkId in project onos by opennetworkinglab.
the class VirtualDeviceCodec method decode.
@Override
public VirtualDevice decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
DeviceId dId = DeviceId.deviceId(extractMember(ID, json));
NetworkId nId = NetworkId.networkId(Long.parseLong(extractMember(NETWORK_ID, json)));
return new DefaultVirtualDevice(nId, dId);
}
use of org.onosproject.incubator.net.virtual.NetworkId in project onos by opennetworkinglab.
the class VirtualLinkCodec method decode.
@Override
public VirtualLink decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
JsonCodec<Link> codec = context.codec(Link.class);
Link link = codec.decode(json, context);
NetworkId nId = NetworkId.networkId(Long.parseLong(extractMember(NETWORK_ID, json)));
return DefaultVirtualLink.builder().networkId(nId).src(link.src()).dst(link.dst()).build();
}
use of org.onosproject.incubator.net.virtual.NetworkId in project onos by opennetworkinglab.
the class VirtualPortCodec method decode.
@Override
public VirtualPort decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
NetworkId nId = NetworkId.networkId(Long.parseLong(extractMember(NETWORK_ID, json)));
DeviceId dId = DeviceId.deviceId(extractMember(DEVICE_ID, json));
VirtualNetworkService vnetService = context.getService(VirtualNetworkService.class);
Set<VirtualDevice> vDevs = vnetService.getVirtualDevices(nId);
VirtualDevice vDev = vDevs.stream().filter(virtualDevice -> virtualDevice.id().equals(dId)).findFirst().orElse(null);
nullIsIllegal(vDev, dId.toString() + INVALID_VIRTUAL_DEVICE);
PortNumber portNum = PortNumber.portNumber(extractMember(PORT_NUM, json));
DeviceId physDId = DeviceId.deviceId(extractMember(PHYS_DEVICE_ID, json));
PortNumber physPortNum = PortNumber.portNumber(extractMember(PHYS_PORT_NUM, json));
ConnectPoint realizedBy = new ConnectPoint(physDId, physPortNum);
return new DefaultVirtualPort(nId, vDev, portNum, realizedBy);
}
use of org.onosproject.incubator.net.virtual.NetworkId in project onos by opennetworkinglab.
the class VirtualListenerRegistryManager method process.
@Override
public void process(VirtualEvent event) {
NetworkId networkId = event.networkId();
Event originalEvent = (Event) event.subject();
ListenerRegistry listenerRegistry = listenerMapByNetwork.get(networkId).get(originalEvent.getClass());
if (listenerRegistry != null) {
listenerRegistry.process(originalEvent);
lastStart = listenerRegistry;
}
}
Aggregations