Search in sources :

Example 16 with NodeConnectorKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey in project genius by opendaylight.

the class MDSALUtil method getNodeConnRef.

public static NodeConnectorRef getNodeConnRef(String nodeId, String port) {
    StringBuilder sb = new StringBuilder();
    sb.append(nodeId);
    sb.append(SEPARATOR);
    sb.append(port);
    String nodeConnectorKeyAsString = sb.toString();
    NodeConnectorId nodeConnectorId = new NodeConnectorId(nodeConnectorKeyAsString);
    NodeConnectorKey nodeConnectorKey = new NodeConnectorKey(nodeConnectorId);
    NodeKey nodeKey = new NodeKey(new NodeId(nodeId));
    InstanceIdentifierBuilder<Node> nodeInstanceIdentifierBuilder = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey);
    InstanceIdentifierBuilder<NodeConnector> nodeConnectorInstanceIdentifierBuilder = nodeInstanceIdentifierBuilder.child(NodeConnector.class, nodeConnectorKey);
    InstanceIdentifier<NodeConnector> nodeConnectorInstanceIdentifier = nodeConnectorInstanceIdentifierBuilder.toInstance();
    NodeConnectorRef nodeConnectorRef = new NodeConnectorRef(nodeConnectorInstanceIdentifier);
    return nodeConnectorRef;
}
Also used : NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Example 17 with NodeConnectorKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey in project openflowplugin by opendaylight.

the class LLDPDiscoveryUtilsTest method testLldpToNodeConnectorRefLLDP.

@Test
public void testLldpToNodeConnectorRefLLDP() throws Exception {
    byte[] packetLLDP = { 0x01, 0x23, 0x00, 0x00, 0x00, 0x01, (byte) 0x8a, (byte) 0x8e, (byte) 0xcc, (byte) 0x85, (byte) 0xeb, 0x27, /* ethernet type LLDP 0x88cc */
    (byte) 0x88, (byte) 0xcc, 0x02, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x02, 0x07, 0x32, 0x06, 0x02, 0x13, 0x37, 0x0a, 0x0a, /* openflow:2 */
    0x6f, 0x70, 0x65, 0x6e, 0x66, 0x6c, 0x6f, 0x77, 0x3a, 0x32, (byte) 0xfe, 0x10, 0x00, 0x26, (byte) 0xe1, 0x00, /* openflow:2:2 */
    0x6f, 0x70, 0x65, 0x6e, 0x66, 0x6c, 0x6f, 0x77, 0x3a, 0x32, 0x3a, 0x32, (byte) 0xfe, 0x14, 0x00, 0x26, (byte) 0xe1, 0x01, 0x62, (byte) 0xc8, 0x2b, 0x67, (byte) 0xce, (byte) 0xbe, 0x7c, 0x2b, 0x47, (byte) 0xbe, 0x2b, (byte) 0xe7, (byte) 0xbc, (byte) 0xe9, 0x75, 0x3d, 0x00, 0x00 };
    NodeConnectorRef nodeConnectorRef = LLDPDiscoveryUtils.lldpToNodeConnectorRef(packetLLDP, false);
    NodeKey nodeKey = nodeConnectorRef.getValue().firstKeyOf(Node.class, NodeKey.class);
    NodeConnectorKey nodeConnectorKey = nodeConnectorRef.getValue().firstKeyOf(NodeConnector.class, NodeConnectorKey.class);
    assertEquals(nodeKey.getId().getValue(), "openflow:2");
    assertEquals(nodeConnectorKey.getId().getValue(), "openflow:2:2");
}
Also used : NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey) Test(org.junit.Test)

Example 18 with NodeConnectorKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey in project openflowplugin by opendaylight.

the class NodeConnectorStatNotificationSupplierImpl method createNotification.

@Override
public NodeConnectorStatisticsUpdate createNotification(final FlowCapableNodeConnectorStatistics flowCapableNodeConnectorStatistics, final InstanceIdentifier<FlowCapableNodeConnectorStatistics> path) {
    Preconditions.checkArgument(flowCapableNodeConnectorStatistics != null);
    Preconditions.checkArgument(path != null);
    final NodeConnectorBuilder ncBuilder = new NodeConnectorBuilder();
    final NodeConnectorKey ncKey = path.firstKeyOf(NodeConnector.class, NodeConnectorKey.class);
    ncBuilder.setId(ncKey.getId());
    ncBuilder.setKey(ncKey);
    final NodeConnectorStatisticsUpdateBuilder builder = new NodeConnectorStatisticsUpdateBuilder();
    builder.setId(getNodeId(path));
    builder.setMoreReplies(Boolean.FALSE);
    builder.setNodeConnector(Collections.singletonList(ncBuilder.build()));
    builder.setNodeConnectorStatisticsAndPortNumberMap(Collections.singletonList(new NodeConnectorStatisticsAndPortNumberMapBuilder(flowCapableNodeConnectorStatistics).build()));
    return builder.build();
}
Also used : NodeConnectorStatisticsAndPortNumberMapBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder) NodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey) NodeConnectorStatisticsUpdateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdateBuilder)

Example 19 with NodeConnectorKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey in project openflowplugin by opendaylight.

the class PortStatsMultipartWriter method storeStatistics.

@Override
public void storeStatistics(final NodeConnectorStatisticsAndPortNumberMap statistics, final boolean withParents) {
    statistics.getNodeConnectorStatisticsAndPortNumberMap().forEach(stat -> {
        final OpenflowVersion openflowVersion = OpenflowVersion.get(features.getVersion());
        final Long port = InventoryDataServiceUtil.portNumberfromNodeConnectorId(openflowVersion, stat.getNodeConnectorId());
        final NodeConnectorId id = InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(features.getDatapathId(), port, OpenflowVersion.get(features.getVersion()));
        writeToTransaction(getInstanceIdentifier().child(NodeConnector.class, new NodeConnectorKey(id)).augmentation(FlowCapableNodeConnectorStatisticsData.class).child(FlowCapableNodeConnectorStatistics.class), new FlowCapableNodeConnectorStatisticsBuilder(stat).build(), OFConstants.OFP_VERSION_1_0 == features.getVersion() || withParents);
    });
}
Also used : FlowCapableNodeConnectorStatisticsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatisticsBuilder) OpenflowVersion(org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion) NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) FlowCapableNodeConnectorStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatistics) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Example 20 with NodeConnectorKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey in project openflowplugin by opendaylight.

the class DeviceContextImpl method writePortStatusMessage.

private void writePortStatusMessage(final PortStatus portStatusMessage) {
    final FlowCapableNodeConnector flowCapableNodeConnector = portStatusTranslator.translate(portStatusMessage, getDeviceInfo(), null);
    final KeyedInstanceIdentifier<NodeConnector, NodeConnectorKey> iiToNodeConnector = getDeviceInfo().getNodeInstanceIdentifier().child(NodeConnector.class, new NodeConnectorKey(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(deviceInfo.getDatapathId(), portStatusMessage.getPortNo(), OpenflowVersion.get(deviceInfo.getVersion()))));
    writeToTransaction(LogicalDatastoreType.OPERATIONAL, iiToNodeConnector, new NodeConnectorBuilder().setKey(iiToNodeConnector.getKey()).addAugmentation(FlowCapableNodeConnectorStatisticsData.class, new FlowCapableNodeConnectorStatisticsDataBuilder().build()).addAugmentation(FlowCapableNodeConnector.class, flowCapableNodeConnector).build());
    submitTransaction();
    if (PortReason.OFPPRDELETE.equals(portStatusMessage.getReason())) {
        addDeleteToTxChain(LogicalDatastoreType.OPERATIONAL, iiToNodeConnector);
        submitTransaction();
    }
}
Also used : NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) FlowCapableNodeConnectorStatisticsDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder) NodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) FlowCapableNodeConnectorStatisticsData(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Aggregations

NodeConnectorKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)28 NodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)17 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)13 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)12 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)11 FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)10 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)10 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)9 NodeConnectorBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder)6 Test (org.junit.Test)5 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)4 ArrayList (java.util.ArrayList)3 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)3 FlowCapableNodeConnectorStatisticsData (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData)3 FlowCapableNodeConnectorStatisticsDataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder)3 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)2 OpenflowVersion (org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion)2 PacketOutConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.PacketOutConvertorData)2 OutputActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder)2 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder)2