use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class EventSubscriptionManager method validGroupId.
/**
* Checks if the group id is valid for this registered application.
*
* @param groupId GroupId assigned to the subscriber
* @param appName Registered Application name
* @return true if valid groupId and false otherwise
*/
private boolean validGroupId(EventSubscriberGroupId groupId, String appName) {
checkNotNull(groupId);
ApplicationId appId = coreService.getAppId(appName);
EventSubscriberGroupId registeredGroupId = registeredApps.get(appId);
if (registeredGroupId.equals(groupId)) {
return true;
}
return false;
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class TunnelQuerySubscriptionCommand method doExecute.
@Override
protected void doExecute() {
TunnelService service = get(TunnelService.class);
ApplicationId applicationId = new DefaultApplicationId(1, consumerId);
Collection<TunnelSubscription> tunnelSet = service.queryTunnelSubscription(applicationId);
for (TunnelSubscription order : tunnelSet) {
print(FMT, order.consumerId(), order.src(), order.dst(), order.type(), order.tunnelId());
}
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class TunnelReturnCommand method doExecute.
@Override
protected void doExecute() {
Tunnel.Type trueType = null;
TunnelService service = get(TunnelService.class);
ApplicationId appId = new DefaultApplicationId(1, consumerId);
ProviderId producerName = new ProviderId("default", "org.onosproject.provider.tunnel.default");
if (!isNull(src) && !isNull(dst) && !isNull(type)) {
TunnelEndPoint srcPoint = null;
TunnelEndPoint dstPoint = null;
if ("MPLS".equals(type)) {
trueType = Tunnel.Type.MPLS;
srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
} else if ("VXLAN".equals(type)) {
trueType = Tunnel.Type.VXLAN;
srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
} else if ("GRE".equals(type)) {
trueType = Tunnel.Type.GRE;
srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
} else if ("VLAN".equals(type)) {
trueType = Tunnel.Type.VLAN;
String[] srcArray = src.split("-");
String[] dstArray = dst.split("-");
srcPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(srcArray[0])), Optional.of(PortNumber.portNumber(srcArray[1])), null, null, OpticalLogicId.logicId(0), true);
dstPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(dstArray[0])), Optional.of(PortNumber.portNumber(dstArray[1])), null, null, OpticalLogicId.logicId(0), true);
} else if ("ODUK".equals(type)) {
trueType = Tunnel.Type.ODUK;
String[] srcArray = src.split("-");
String[] dstArray = dst.split("-");
srcPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(srcArray[0])), Optional.of(PortNumber.portNumber(srcArray[1])), null, OpticalTunnelEndPoint.Type.LAMBDA, OpticalLogicId.logicId(0), true);
dstPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(dstArray[0])), Optional.of(PortNumber.portNumber(dstArray[1])), null, OpticalTunnelEndPoint.Type.LAMBDA, OpticalLogicId.logicId(0), true);
} else if ("OCH".equals(type)) {
trueType = Tunnel.Type.OCH;
String[] srcArray = src.split("-");
String[] dstArray = dst.split("-");
srcPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(srcArray[0])), Optional.of(PortNumber.portNumber(srcArray[1])), null, OpticalTunnelEndPoint.Type.TIMESLOT, OpticalLogicId.logicId(0), true);
dstPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(dstArray[0])), Optional.of(PortNumber.portNumber(dstArray[1])), null, OpticalTunnelEndPoint.Type.TIMESLOT, OpticalLogicId.logicId(0), true);
} else {
print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
return;
}
service.returnTunnel(appId, srcPoint, dstPoint, trueType);
}
if (!isNull(tunnelId)) {
TunnelId id = TunnelId.valueOf(tunnelId);
service.returnTunnel(appId, id);
}
if (!isNull(tunnelName)) {
TunnelName name = TunnelName.tunnelName(tunnelName);
service.returnTunnel(appId, name);
}
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class TunnelSubscriptionTest method testEquality.
/**
* Checks the operation of equals(), hashCode() and toString() methods.
*/
@Test
public void testEquality() {
TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423));
TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421));
ApplicationId appId = new DefaultApplicationId(243, "test");
ApplicationId appId2 = new DefaultApplicationId(2431, "test1");
TunnelId tunnelId = TunnelId.valueOf("41654654");
TunnelSubscription p1 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN, null);
TunnelSubscription p2 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN, null);
TunnelSubscription p3 = new TunnelSubscription(appId2, src, dst, tunnelId, Tunnel.Type.VXLAN, null);
new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3).testEquals();
}
use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.
the class FlowTableConfigTest method setUp.
@Before
public void setUp() throws Exception {
directory.add(CoreService.class, new CoreServiceAdapter() {
@Override
public ApplicationId getAppId(Short id) {
return APP_ID;
}
@Override
public ApplicationId registerApplication(String name) {
return APP_ID;
}
});
mapper = testFriendlyMapper();
JsonNode sample = loadJsonFromResource(SAMPLE, mapper);
cfgnode = sample.path("devices").path(DID.toString()).path(FlowTableConfig.CONFIG_KEY);
}
Aggregations