Search in sources :

Example 1 with DatapathId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId in project netvirt by opendaylight.

the class ElanBridgeManager method buildBridgeOtherConfigs.

private List<BridgeOtherConfigs> buildBridgeOtherConfigs(Node ovsdbNode, String bridgeName, String mac) {
    // First attempt to extract the bridge augmentation from operational...
    Node bridgeNode = southboundUtils.getBridgeNode(ovsdbNode, bridgeName);
    OvsdbBridgeAugmentation bridgeAug = null;
    if (bridgeNode != null) {
        bridgeAug = southboundUtils.extractBridgeAugmentation(bridgeNode);
    }
    // ...if present, it means this bridge already exists and we need to take
    // care not to change the datapath id. We do this by explicitly setting
    // other_config:datapath-id to the value reported in the augmentation.
    List<BridgeOtherConfigs> otherConfigs;
    if (bridgeAug != null) {
        DatapathId dpId = bridgeAug.getDatapathId();
        if (dpId != null) {
            otherConfigs = bridgeAug.getBridgeOtherConfigs();
            if (otherConfigs == null) {
                otherConfigs = Lists.newArrayList();
            }
            if (otherConfigs.stream().noneMatch(otherConfig -> otherConfig.getBridgeOtherConfigKey().equals(OTHER_CONFIG_DATAPATH_ID))) {
                String dpIdVal = dpId.getValue().replace(":", "");
                otherConfigs.add(new BridgeOtherConfigsBuilder().setBridgeOtherConfigKey(OTHER_CONFIG_DATAPATH_ID).setBridgeOtherConfigValue(dpIdVal).build());
            }
        } else {
            otherConfigs = Lists.newArrayList();
        }
    } else {
        otherConfigs = Lists.newArrayList();
        if (mac != null) {
            otherConfigs.add(new BridgeOtherConfigsBuilder().setBridgeOtherConfigKey(OTHER_CONFIG_HWADDR).setBridgeOtherConfigValue(mac).build());
        }
    }
    if (otherConfigs.stream().noneMatch(otherConfig -> otherConfig.getBridgeOtherConfigKey().equals(OTHER_CONFIG_DISABLE_IN_BAND))) {
        otherConfigs.add(new BridgeOtherConfigsBuilder().setBridgeOtherConfigKey(OTHER_CONFIG_DISABLE_IN_BAND).setBridgeOtherConfigValue("true").build());
    }
    return otherConfigs;
}
Also used : OvsdbBridgeAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) BridgeOtherConfigs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigs) DatapathId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId) BridgeOtherConfigsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigsBuilder)

Example 2 with DatapathId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId in project netvirt by opendaylight.

the class ElanBridgeManager method getDpIdFromManagerNodeId.

@Override
public Optional<BigInteger> getDpIdFromManagerNodeId(String managerNodeId) {
    InstanceIdentifier<Node> identifier = getIntegrationBridgeIdentifier(managerNodeId);
    OvsdbBridgeAugmentation integrationBridgeAugmentation = interfaceManager.getOvsdbBridgeForNodeIid(identifier);
    if (integrationBridgeAugmentation == null) {
        LOG.debug("Failed to get OvsdbBridgeAugmentation for node {}", managerNodeId);
        return Optional.empty();
    }
    return Optional.ofNullable(integrationBridgeAugmentation.getDatapathId()).map(datapathId -> MDSALUtil.getDpnId(datapathId.getValue()));
}
Also used : OvsdbBridgeAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)

Example 3 with DatapathId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId in project openflowplugin by opendaylight.

the class OfToSalInPhyPortCase method process.

@Override
public Optional<MatchBuilder> process(@Nonnull InPhyPortCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
    final MatchBuilder matchBuilder = data.getMatchBuilder();
    final OpenflowVersion ofVersion = OpenflowVersion.get(data.getVersion());
    final BigInteger datapathId = data.getDatapathId();
    final PortNumber portNumber = source.getInPhyPort().getPortNumber();
    if (portNumber != null) {
        matchBuilder.setInPhyPort(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathId, portNumber.getValue(), ofVersion));
    }
    return Optional.of(matchBuilder);
}
Also used : OpenflowVersion(org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion) BigInteger(java.math.BigInteger) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)

Example 4 with DatapathId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId in project openflowplugin by opendaylight.

the class InventoryDataServiceUtil method nodeConnectorUpdatedBuilderFromDatapathIdPortNo.

public static NodeConnectorUpdatedBuilder nodeConnectorUpdatedBuilderFromDatapathIdPortNo(final BigInteger datapathId, final Long portNo, final OpenflowVersion ofVersion) {
    NodeConnectorUpdatedBuilder builder = new NodeConnectorUpdatedBuilder();
    builder.setId(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathId, portNo, ofVersion));
    builder.setNodeConnectorRef(InventoryDataServiceUtil.nodeConnectorRefFromDatapathIdPortno(datapathId, portNo, ofVersion));
    return builder;
}
Also used : NodeConnectorUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdatedBuilder)

Example 5 with DatapathId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId in project openflowplugin by opendaylight.

the class InventoryDataServiceUtil method nodeConnectorInstanceIdentifierFromDatapathIdPortno.

public static InstanceIdentifier<NodeConnector> nodeConnectorInstanceIdentifierFromDatapathIdPortno(final BigInteger datapathId, final Long portNo, final OpenflowVersion ofVersion) {
    NodeId nodeId = nodeIdFromDatapathId(datapathId);
    KeyedInstanceIdentifier<Node, NodeKey> nodePath = NODES_IDENTIFIER.child(Node.class, new NodeKey(nodeId));
    return nodeConnectorInstanceIdentifierFromDatapathIdPortno(datapathId, portNo, ofVersion, nodePath);
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Aggregations

BigInteger (java.math.BigInteger)10 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)8 OpenflowVersion (org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion)7 NodeConnectorRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef)6 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)6 ActionConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData)5 GetFeaturesOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput)5 OvsdbBridgeAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation)5 List (java.util.List)4 DatapathId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId)4 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)4 ByteBuf (io.netty.buffer.ByteBuf)3 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)3 NodeConnectorUpdatedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdatedBuilder)3 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)3 OvsdbBridgeAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentationBuilder)3 OvsdbBridgeName (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeName)3 NodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder)3