Search in sources :

Example 6 with TopologyId

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project bgpcep by opendaylight.

the class ServerSessionManager method instantiateServiceInstance.

/**
 * Create Base Topology.
 */
synchronized void instantiateServiceInstance() {
    final TopologyKey key = InstanceIdentifier.keyOf(this.topology);
    final TopologyId topologyId = key.getTopologyId();
    final WriteTransaction tx = this.dependenciesProvider.getDataBroker().newWriteOnlyTransaction();
    tx.put(LogicalDatastoreType.OPERATIONAL, this.topology, new TopologyBuilder().setKey(key).setTopologyId(topologyId).setTopologyTypes(new TopologyTypesBuilder().addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder().setTopologyPcep(new TopologyPcepBuilder().build()).build()).build()).setNode(new ArrayList<>()).build(), true);
    try {
        tx.submit().get();
        LOG.info("PCEP Topology {} created successfully.", topologyId.getValue());
        ServerSessionManager.this.isClosed.set(false);
    } catch (final ExecutionException | InterruptedException throwable) {
        LOG.error("Failed to create PCEP Topology {}.", topologyId.getValue(), throwable);
        ServerSessionManager.this.isClosed.set(true);
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) TopologyTypesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypesBuilder) TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) TopologyBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder) TopologyTypes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1) TopologyTypes1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.TopologyTypes1Builder) TopologyPcepBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.topology.pcep.type.TopologyPcepBuilder) ExecutionException(java.util.concurrent.ExecutionException) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)

Example 7 with TopologyId

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project bgpcep by opendaylight.

the class PCEPTopologyDeployerImpl method updateTopologyProvider.

private synchronized void updateTopologyProvider(final Topology topology) {
    if (!filterPcepTopologies(topology.getTopologyTypes())) {
        return;
    }
    final TopologyId topologyId = topology.getTopologyId();
    LOG.info("Updating Topology {}", topologyId);
    final PCEPTopologyProviderBean previous = this.pcepTopologyServices.remove(topology.getTopologyId());
    closeTopology(previous, topologyId);
    createTopologyProvider(topology);
}
Also used : TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)

Example 8 with TopologyId

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project bgpcep by opendaylight.

the class PCEPTopologyDeployerImpl method createTopologyProvider.

private synchronized void createTopologyProvider(final Topology topology) {
    if (!filterPcepTopologies(topology.getTopologyTypes())) {
        return;
    }
    final TopologyId topologyId = topology.getTopologyId();
    if (this.pcepTopologyServices.containsKey(topology.getTopologyId())) {
        LOG.warn("Topology Provider {} already exist. New instance won't be created", topologyId);
        return;
    }
    LOG.info("Creating Topology {}", topologyId);
    LOG.trace("Topology {}.", topology);
    final SessionConfig config = topology.getAugmentation(PcepTopologyTypeConfig.class).getSessionConfig();
    final InstructionScheduler instructionScheduler = this.instructionSchedulerFactory.createInstructionScheduler(topologyId.getValue());
    final PCEPTopologyConfiguration dependencies = new PCEPTopologyConfiguration(config, topology);
    final PCEPTopologyProviderBean pcepTopologyProviderBean = (PCEPTopologyProviderBean) this.container.getComponentInstance(PCEPTopologyProviderBean.class.getSimpleName());
    this.pcepTopologyServices.put(topologyId, pcepTopologyProviderBean);
    pcepTopologyProviderBean.start(dependencies, instructionScheduler);
}
Also used : PcepTopologyTypeConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.config.rev171025.PcepTopologyTypeConfig) SessionConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev171025.pcep.config.SessionConfig) InstructionScheduler(org.opendaylight.bgpcep.programming.spi.InstructionScheduler) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)

Example 9 with TopologyId

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project genius by opendaylight.

the class HwVtepTunnelsStateHandler method startMonitoringTask.

@Override
public void startMonitoringTask(MonitoringInfo monitorInfo) {
    EndpointType source = monitorInfo.getSource().getEndpointType();
    if (source instanceof Interface) {
        Interface intf = (Interface) source;
        intf.getInterfaceName();
    } else {
        LOG.warn("Invalid source endpoint. Could not retrieve source interface to configure BFD");
        return;
    }
    MonitorProfile profile;
    long profileId = monitorInfo.getProfileId();
    Optional<MonitorProfile> optProfile = alivenessMonitor.getMonitorProfile(profileId);
    if (optProfile.isPresent()) {
        profile = optProfile.get();
    } else {
        LOG.warn("No monitor profile associated with id {}. " + "Could not send Monitor packet for monitor-id {}", profileId, monitorInfo);
        return;
    }
    // TODO: get the corresponding hwvtep tunnel from the sourceInterface
    // once InterfaceMgr
    // Implements renderer for hwvtep VXLAN tunnels
    String tunnelLocalMacAddress = "<TODO>";
    String tunnelLocalIpAddress = "<TODO>";
    String tunnelRemoteMacAddress = "<TODO>";
    List<BfdParams> bfdParams = new ArrayList<>();
    fillBfdParams(bfdParams, profile);
    List<BfdLocalConfigs> bfdLocalConfigs = new ArrayList<>();
    fillBfdLocalConfigs(bfdLocalConfigs, tunnelLocalMacAddress, tunnelLocalIpAddress);
    List<BfdRemoteConfigs> bfdRemoteConfigs = new ArrayList<>();
    fillBfdRemoteConfigs(bfdRemoteConfigs, tunnelRemoteMacAddress);
    // tunnelKey is initialized to null and passed to setKey which FindBugs flags as a
    // "Load of known null value" violation. Not sure sure what the intent is...
    // TunnelsKey tunnelKey = null;
    Tunnels tunnelWithBfd = new TunnelsBuilder().setKey(/*tunnelKey*/
    null).setBfdParams(bfdParams).setBfdLocalConfigs(bfdLocalConfigs).setBfdRemoteConfigs(bfdRemoteConfigs).build();
    // TODO: get the following parameters from the interface and use it to
    // update hwvtep datastore
    // and not sure sure tunnels are creating immediately once interface mgr
    // writes termination point
    // into hwvtep datastore. if tunnels are not created during that time,
    // then start monitoring has to
    // be done as part of tunnel add DCN handling.
    String topologyId = "";
    String nodeId = "";
    MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, getTunnelIdentifier(topologyId, nodeId, new TunnelsKey(/*localRef*/
    null, /*remoteRef*/
    null)), tunnelWithBfd);
}
Also used : BfdLocalConfigs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdLocalConfigs) MonitorProfile(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile) ArrayList(java.util.ArrayList) TunnelsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsBuilder) EndpointType(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.EndpointType) BfdRemoteConfigs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdRemoteConfigs) TunnelsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsKey) BfdParams(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams) Interface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.Interface) Tunnels(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels)

Example 10 with TopologyId

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId in project bgpcep by opendaylight.

the class NetworkTopologyConfigFileProcessorTest method configFileTest.

@Test
public void configFileTest() throws ReadFailedException, InterruptedException {
    final KeyedInstanceIdentifier<Topology, TopologyKey> topologyIIdKeyed = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(new TopologyId("topology-test")));
    checkNotPresentConfiguration(getDataBroker(), topologyIIdKeyed);
    assertNotNull(ClassLoader.getSystemClassLoader().getResource("initial/network-topology-config.xml"));
    final NetworkTopologyConfigFileProcessor processor = new NetworkTopologyConfigFileProcessor(this.configLoader, getDataBroker());
    processor.init();
    checkPresentConfiguration(getDataBroker(), topologyIIdKeyed);
    assertEquals(SchemaPath.create(true, NetworkTopology.QNAME), processor.getSchemaPath());
    processor.close();
}
Also used : TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId) Test(org.junit.Test)

Aggregations

TopologyId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)18 TopologyKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey)12 NetworkTopology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology)11 Topology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology)7 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)6 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)6 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)5 ExecutionException (java.util.concurrent.ExecutionException)4 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)2 TransactionChainListener (org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener)2 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)2 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)2 Tunnels (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels)2 TunnelsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsBuilder)2 TunnelsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsKey)2 BfdParams (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams)2 PcepTopologyNodeStatsAug (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.stats.rev171113.PcepTopologyNodeStatsAug)2 TopologyBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder)2