Search in sources :

Example 26 with Reference

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.set.community.set.community.method.Reference in project netvirt by opendaylight.

the class InterVpnLinkUtil method installLPortDispatcherTableFlow.

/**
 * Installs a Flow in LPortDispatcher table that matches on SI=2 and
 * the lportTag of one InterVpnLink's endpoint and sets the vrfTag of the
 * other endpoint and sends to FIB table.
 *
 * @param broker dataBroker service reference
 * @param mdsalManager MDSAL API accessor
 * @param interVpnLinkName Name of the InterVpnLink.
 * @param dpnList The list of DPNs where this flow must be installed
 * @param vpnUuidOtherEndpoint UUID of the other endpoint of the InterVpnLink
 * @param lportTagOfOtherEndpoint Dataplane identifier of the other endpoint of the InterVpnLink
 * @return the list of Futures for each and every flow that has been installed
 */
public static List<ListenableFuture<Void>> installLPortDispatcherTableFlow(DataBroker broker, IMdsalApiManager mdsalManager, String interVpnLinkName, List<BigInteger> dpnList, String vpnUuidOtherEndpoint, Long lportTagOfOtherEndpoint) {
    List<ListenableFuture<Void>> result = new ArrayList<>();
    long vpnId = VpnUtil.getVpnId(broker, vpnUuidOtherEndpoint);
    for (BigInteger dpnId : dpnList) {
        // insert into LPortDispatcher table
        Flow lportDispatcherFlow = buildLPortDispatcherFlow(interVpnLinkName, vpnId, lportTagOfOtherEndpoint.intValue());
        result.add(mdsalManager.installFlow(dpnId, lportDispatcherFlow));
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) BigInteger(java.math.BigInteger) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 27 with Reference

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.set.community.set.community.method.Reference in project netvirt by opendaylight.

the class ArpResponderUtil method removeFlow.

/**
 * Remove flow form DPN.
 *
 * @param mdSalManager
 *            Reference of MDSAL API RPC that provides API for installing
 *            flow
 * @param dpnId
 *            DPN form which flow to be removed
 * @param flowId
 *            Uniquely Identifiable Arp Responder Table flow Id that is to
 *            be removed
 */
public static void removeFlow(IMdsalApiManager mdSalManager, BigInteger dpnId, String flowId) {
    Flow flowEntity = MDSALUtil.buildFlow(NwConstants.ARP_RESPONDER_TABLE, flowId);
    mdSalManager.removeFlow(dpnId, flowEntity);
}
Also used : Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 28 with Reference

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.set.community.set.community.method.Reference in project netvirt by opendaylight.

the class ElanServiceChainUtils method updateElanToLportTagMap.

/**
 * Stores the relation between ElanLport and scfTag.
 *
 * @param broker dataBroker service reference
 * @param elanInstanceName Name of the ELAN. Typically its UUID
 * @param lportTag Dataplane identifier of the ElanPseudoPort
 * @param scfTag Dataplane identifier of the SCF
 * @param addOrRemove States if flows must be added or removed
 */
public static void updateElanToLportTagMap(final DataBroker broker, final String elanInstanceName, final int lportTag, final long scfTag, final int addOrRemove) {
    Long portTag = Long.valueOf(lportTag);
    ElanToPseudoPortDataKey key = new ElanToPseudoPortDataKey(portTag, scfTag);
    InstanceIdentifier<ElanToPseudoPortData> path = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, new ElanInstanceKey(elanInstanceName)).augmentation(ElanServiceChainState.class).child(ElanToPseudoPortData.class, key).build();
    if (addOrRemove == NwConstants.ADD_FLOW) {
        ElanToPseudoPortData newValue = new ElanToPseudoPortDataBuilder().setKey(key).setElanLportTag(portTag).setScfTag(scfTag).build();
        MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, path, newValue);
    } else {
        MDSALUtil.syncDelete(broker, LogicalDatastoreType.CONFIGURATION, path);
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ElanToPseudoPortDataKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortDataKey) ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) ElanToPseudoPortDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortDataBuilder) ElanToPseudoPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortData)

Example 29 with Reference

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.set.community.set.community.method.Reference in project openflowplugin by opendaylight.

the class NodeConnectorRefToPortTranslator method fromNodeConnectorRef.

/**
 * Gets port number from {@link NodeConnectorRef}.
 * @param nodeConnectorRef Node connector reference
 * @param version Openflow version
 * @return port number
 */
@SuppressWarnings("unchecked")
@Nullable
public static Long fromNodeConnectorRef(@Nonnull NodeConnectorRef nodeConnectorRef, short version) {
    Preconditions.checkNotNull(nodeConnectorRef);
    Long port = null;
    final InstanceIdentifier<?> value = nodeConnectorRef.getValue();
    if (value instanceof KeyedInstanceIdentifier) {
        KeyedInstanceIdentifier<NodeConnector, NodeConnectorKey> identifier = (KeyedInstanceIdentifier<NodeConnector, NodeConnectorKey>) value;
        OpenflowVersion ofVersion = OpenflowVersion.get(version);
        String nodeConnectorId = identifier.getKey().getId().getValue();
        port = InventoryDataServiceUtil.portNumberfromNodeConnectorId(ofVersion, nodeConnectorId);
    }
    return port;
}
Also used : NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) OpenflowVersion(org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey) Nullable(javax.annotation.Nullable)

Example 30 with Reference

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.actions.bgp.actions.set.community.set.community.method.Reference in project openflowplugin by opendaylight.

the class PacketInDispatcherImpl method onPacketReceived.

@Override
public void onPacketReceived(PacketReceived notification) {
    // find corresponding handler
    /*
         * Notification contains reference to ingress port
         * in a form of path in inventory: /nodes/node/node-connector
         *
         * In order to get path we shorten path to the first node reference
         * by using firstIdentifierOf helper method provided by InstanceIdentifier,
         * this will effectively shorten the path to /nodes/node.
         */
    InstanceIdentifier<?> ingressPort = notification.getIngress().getValue();
    InstanceIdentifier<Node> nodeOfPacket = ingressPort.firstIdentifierOf(Node.class);
    /**
     * We lookup up the the packet-in listener for this node.
     */
    PacketProcessingListener nodeHandler = handlerMapping.get(nodeOfPacket);
    /**
     * If we have packet-processing listener, we delegate notification.
     */
    if (nodeHandler != null) {
        nodeHandler.onPacketReceived(notification);
    }
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) PacketProcessingListener(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener)

Aggregations

ArrayList (java.util.ArrayList)8 Test (org.junit.Test)6 RouteAttributeContainer (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer)6 Statement (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.Statement)6 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)6 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)4 BigInteger (java.math.BigInteger)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 Nullable (javax.annotation.Nullable)3 VrfEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry)3 CommunitiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.CommunitiesBuilder)3 StringUtils (org.apache.commons.lang3.StringUtils)2 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)2 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)2 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)2 RouteEntryBaseAttributes (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.RouteEntryBaseAttributes)2 BgpActionPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionPolicy)2 BGPRouteEntryExportParameters (org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameters)2 BGPRouteEntryImportParameters (org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryImportParameters)2