Search in sources :

Example 1 with BridgeOtherConfigs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigs 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)

Aggregations

DatapathId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId)1 OvsdbBridgeAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation)1 BridgeOtherConfigs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigs)1 BridgeOtherConfigsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigsBuilder)1 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)1