use of org.onosproject.net.DefaultAnnotations in project onos by opennetworkinglab.
the class JuniperUtils method createBiDirLinkDescription.
/**
* Create two LinkDescriptions corresponding to the bidirectional links.
*
* @param localDevId the identity of the local device
* @param localPort the port of the local device
* @param remoteDevId the identity of the remote device
* @param remotePort the port of the remote device
* @param descs the collection to which the link descriptions
* should be added
*/
public static void createBiDirLinkDescription(DeviceId localDevId, Port localPort, DeviceId remoteDevId, Port remotePort, Set<LinkDescription> descs) {
ConnectPoint local = new ConnectPoint(localDevId, localPort.number());
ConnectPoint remote = new ConnectPoint(remoteDevId, remotePort.number());
DefaultAnnotations annotations = DefaultAnnotations.builder().set(AnnotationKeys.LAYER, "ETHERNET").build();
descs.add(new DefaultLinkDescription(local, remote, Link.Type.DIRECT, true, annotations));
descs.add(new DefaultLinkDescription(remote, local, Link.Type.DIRECT, true, annotations));
}
use of org.onosproject.net.DefaultAnnotations in project onos by opennetworkinglab.
the class ECDeviceStore method mergeAnnotations.
private DefaultAnnotations mergeAnnotations(DeviceId deviceId) {
ProviderId primaryProviderId = getPrimaryProviderId(deviceId);
DeviceDescription primaryDeviceDescription = deviceDescriptions.get(new DeviceKey(primaryProviderId, deviceId));
DefaultAnnotations annotations = DefaultAnnotations.builder().build();
annotations = merge(annotations, primaryDeviceDescription.annotations());
for (ProviderId providerId : getAllProviders(deviceId)) {
if (!providerId.equals(primaryProviderId)) {
annotations = merge(annotations, deviceDescriptions.get(new DeviceKey(providerId, deviceId)).annotations());
}
}
return annotations;
}
use of org.onosproject.net.DefaultAnnotations in project onos by opennetworkinglab.
the class VirtualNetworkWebResourceTest method testPostVirtualPort.
/**
* Tests adding of new virtual port using POST via JSON stream.
*/
@Test
public void testPostVirtualPort() {
NetworkId networkId = networkId3;
DeviceId deviceId = devId22;
DefaultAnnotations annotations = DefaultAnnotations.builder().build();
Device physDevice = new DefaultDevice(null, DeviceId.deviceId("dev1"), null, null, null, null, null, null, annotations);
ConnectPoint cp1 = new ConnectPoint(physDevice.id(), portNumber(1));
expect(mockVnetAdminService.createVirtualPort(networkId, deviceId, portNumber(22), cp1)).andReturn(vport22);
replay(mockVnetAdminService);
WebTarget wt = target();
InputStream jsonStream = VirtualNetworkWebResourceTest.class.getResourceAsStream("post-virtual-port.json");
String reqLocation = "vnets/" + networkId.toString() + "/devices/" + deviceId.toString() + "/ports";
Response response = wt.path(reqLocation).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(jsonStream));
assertThat(response.getStatus(), is(HttpURLConnection.HTTP_CREATED));
verify(mockVnetAdminService);
}
use of org.onosproject.net.DefaultAnnotations in project onos by opennetworkinglab.
the class AnnotationConstraintTest method setUp.
@Before
public void setUp() {
resourceContext = createMock(ResourceContext.class);
DefaultAnnotations annotations = DefaultAnnotations.builder().set(KEY, String.valueOf(VALUE)).build();
link = DefaultLink.builder().providerId(PID).src(cp(DID1, PID1)).dst(cp(DID2, PID2)).type(DIRECT).annotations(annotations).build();
}
use of org.onosproject.net.DefaultAnnotations in project onos by opennetworkinglab.
the class FujitsuT100DeviceDescription method parseT100OduPort.
private static PortDescription parseT100OduPort(HierarchicalConfiguration cfg, long count) {
PortNumber portNumber = PortNumber.portNumber(count);
HierarchicalConfiguration ethernetConfig = cfg.configurationAt("ethernet");
boolean enabled = "up".equals(ethernetConfig.getString("administrative-state"));
// Rate is in kbps
CltSignalType signalType = "100000000".equals(ethernetConfig.getString("rate")) ? CltSignalType.CLT_100GBE : null;
DefaultAnnotations annotations = DefaultAnnotations.builder().set(AnnotationKeys.PORT_NAME, cfg.getString("name")).build();
return oduCltPortDescription(portNumber, enabled, signalType, annotations);
}
Aggregations