Search in sources :

Example 1 with BfdRemoteConfigs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdRemoteConfigs 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)

Aggregations

ArrayList (java.util.ArrayList)1 EndpointType (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.EndpointType)1 Interface (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.Interface)1 MonitorProfile (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile)1 Tunnels (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels)1 TunnelsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsBuilder)1 TunnelsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsKey)1 BfdLocalConfigs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdLocalConfigs)1 BfdParams (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams)1 BfdRemoteConfigs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdRemoteConfigs)1