diff options
Diffstat (limited to 'framework/src/onos/apps/sdnip/src/main')
14 files changed, 0 insertions, 1633 deletions
diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java deleted file mode 100644 index 09d4a436..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.sdnip; - -import static java.util.concurrent.Executors.newSingleThreadExecutor; -import static org.onlab.util.Tools.groupedThreads; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; - -import org.onosproject.core.ApplicationId; -import org.onosproject.net.intent.Intent; -import org.onosproject.net.intent.IntentService; -import org.onosproject.net.intent.IntentState; -import org.onosproject.net.intent.IntentUtils; -import org.onosproject.net.intent.Key; -import org.onosproject.routing.IntentSynchronizationService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Synchronizes intents between the in-memory intent store and the - * IntentService. - */ -public class IntentSynchronizer implements IntentSynchronizationService { - - private static final Logger log = - LoggerFactory.getLogger(IntentSynchronizer.class); - - private final ApplicationId appId; - private final IntentService intentService; - - private final Map<Key, Intent> intents; - - // - // State to deal with the Leader election and pushing Intents - // - private final ExecutorService intentsSynchronizerExecutor; - private volatile boolean isElectedLeader = false; - private volatile boolean isActivatedLeader = false; - - /** - * Class constructor. - * - * @param appId the Application ID - * @param intentService the intent service - */ - public IntentSynchronizer(ApplicationId appId, IntentService intentService) { - this(appId, intentService, - newSingleThreadExecutor(groupedThreads("onos/" + appId, "sync"))); - } - - /** - * Class constructor. - * - * @param appId the Application ID - * @param intentService the intent service - * @param executorService executor service for synchronization thread - */ - public IntentSynchronizer(ApplicationId appId, IntentService intentService, - ExecutorService executorService) { - this.appId = appId; - this.intentService = intentService; - - intents = new ConcurrentHashMap<>(); - - intentsSynchronizerExecutor = executorService; - } - - /** - * Starts the synchronizer. - */ - public void start() { - - } - - /** - * Stops the synchronizer. - */ - public void stop() { - synchronized (this) { - // Stop the thread(s) - intentsSynchronizerExecutor.shutdownNow(); - log.info("Intents Synchronizer Executor shutdown completed"); - - } - } - - /** - * Withdraws all intents. - */ - public void removeIntents() { - if (!isElectedLeader) { - // only leader will withdraw intents - return; - } - - log.debug("Intent Synchronizer shutdown: withdrawing all intents..."); - - for (Entry<Key, Intent> entry : intents.entrySet()) { - intentService.withdraw(entry.getValue()); - log.debug("Intent Synchronizer withdrawing intent: {}", - entry.getValue()); - } - - intents.clear(); - log.info("Tried to clean all intents"); - } - - @Override - public void submit(Intent intent) { - synchronized (this) { - intents.put(intent.key(), intent); - if (isElectedLeader && isActivatedLeader) { - log.trace("Submitting intent: {}", intent); - intentService.submit(intent); - } - } - } - - @Override - public void withdraw(Intent intent) { - synchronized (this) { - intents.remove(intent.key(), intent); - if (isElectedLeader && isActivatedLeader) { - log.trace("Withdrawing intent: {}", intent); - intentService.withdraw(intent); - } - } - } - - /** - * Signals the synchronizer that the leadership has changed. - * - * @param isLeader true if this instance is now the leader, otherwise false - */ - public void leaderChanged(boolean isLeader) { - log.debug("Leader changed: {}", isLeader); - - if (!isLeader) { - this.isElectedLeader = false; - this.isActivatedLeader = false; - return; // Nothing to do - } - this.isActivatedLeader = false; - this.isElectedLeader = true; - - // Run the synchronization method off-thread - intentsSynchronizerExecutor.execute(this::synchronizeIntents); - } - - private void synchronizeIntents() { - Map<Key, Intent> serviceIntents = new HashMap<>(); - intentService.getIntents().forEach(i -> { - if (i.appId().equals(appId)) { - serviceIntents.put(i.key(), i); - } - }); - - List<Intent> intentsToAdd = new LinkedList<>(); - List<Intent> intentsToRemove = new LinkedList<>(); - - for (Intent localIntent : intents.values()) { - Intent serviceIntent = serviceIntents.remove(localIntent.key()); - if (serviceIntent == null) { - intentsToAdd.add(localIntent); - } else { - IntentState state = intentService.getIntentState(serviceIntent.key()); - if (!IntentUtils.equals(serviceIntent, localIntent) || state == null || - state == IntentState.WITHDRAW_REQ || - state == IntentState.WITHDRAWING || - state == IntentState.WITHDRAWN) { - intentsToAdd.add(localIntent); - } - } - } - - for (Intent serviceIntent : serviceIntents.values()) { - IntentState state = intentService.getIntentState(serviceIntent.key()); - if (state != null && state != IntentState.WITHDRAW_REQ - && state != IntentState.WITHDRAWING - && state != IntentState.WITHDRAWN) { - intentsToRemove.add(serviceIntent); - } - } - - log.debug("Intent Synchronizer: submitting {}, withdrawing {}", - intentsToAdd.size(), intentsToRemove.size()); - - // Withdraw Intents - for (Intent intent : intentsToRemove) { - intentService.withdraw(intent); - log.trace("Intent Synchronizer: withdrawing intent: {}", - intent); - } - if (!isElectedLeader) { - log.debug("Intent Synchronizer: cannot withdraw intents: " + - "not elected leader anymore"); - isActivatedLeader = false; - return; - } - - // Add Intents - for (Intent intent : intentsToAdd) { - intentService.submit(intent); - log.trace("Intent Synchronizer: submitting intent: {}", - intent); - } - if (!isElectedLeader) { - log.debug("Intent Synchronizer: cannot submit intents: " + - "not elected leader anymore"); - isActivatedLeader = false; - return; - } - - if (isElectedLeader) { - isActivatedLeader = true; // Allow push of Intents - } else { - isActivatedLeader = false; - } - log.debug("Intent synchronization completed"); - } -} diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java deleted file mode 100644 index edc2df4d..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java +++ /dev/null @@ -1,412 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.sdnip; - -import org.onlab.packet.Ethernet; -import org.onlab.packet.IPv4; -import org.onlab.packet.IPv6; -import org.onlab.packet.IpAddress; -import org.onlab.packet.IpPrefix; -import org.onlab.packet.TpPort; -import org.onosproject.core.ApplicationId; -import org.onosproject.incubator.net.intf.Interface; -import org.onosproject.incubator.net.intf.InterfaceService; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.config.NetworkConfigEvent; -import org.onosproject.net.config.NetworkConfigListener; -import org.onosproject.net.config.NetworkConfigService; -import org.onosproject.net.flow.DefaultTrafficSelector; -import org.onosproject.net.flow.DefaultTrafficTreatment; -import org.onosproject.net.flow.TrafficSelector; -import org.onosproject.net.flow.TrafficTreatment; -import org.onosproject.net.host.InterfaceIpAddress; -import org.onosproject.net.intent.IntentUtils; -import org.onosproject.net.intent.Key; -import org.onosproject.net.intent.PointToPointIntent; -import org.onosproject.routing.IntentSynchronizationService; -import org.onosproject.routing.RoutingService; -import org.onosproject.routing.config.BgpConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Manages the connectivity requirements between peers. - */ -public class PeerConnectivityManager { - private static final int PRIORITY_OFFSET = 1000; - - private static final String SUFFIX_DST = "dst"; - private static final String SUFFIX_SRC = "src"; - private static final String SUFFIX_ICMP = "icmp"; - - private static final Logger log = LoggerFactory.getLogger( - PeerConnectivityManager.class); - - private static final short BGP_PORT = 179; - - private final IntentSynchronizationService intentSynchronizer; - private final NetworkConfigService configService; - private final InterfaceService interfaceService; - - private final ApplicationId appId; - private final ApplicationId routerAppId; - - private final Map<Key, PointToPointIntent> peerIntents; - - private final InternalNetworkConfigListener configListener - = new InternalNetworkConfigListener(); - - /** - * Creates a new PeerConnectivityManager. - * - * @param appId the application ID - * @param intentSynchronizer the intent synchronizer - * @param configService the SDN-IP config service - * @param interfaceService the interface service - * @param routerAppId application ID - */ - public PeerConnectivityManager(ApplicationId appId, - IntentSynchronizationService intentSynchronizer, - NetworkConfigService configService, - ApplicationId routerAppId, - InterfaceService interfaceService) { - this.appId = appId; - this.intentSynchronizer = intentSynchronizer; - this.configService = configService; - this.routerAppId = routerAppId; - this.interfaceService = interfaceService; - - peerIntents = new HashMap<>(); - } - - /** - * Starts the peer connectivity manager. - */ - public void start() { - configService.addListener(configListener); - setUpConnectivity(); - } - - /** - * Stops the peer connectivity manager. - */ - public void stop() { - configService.removeListener(configListener); - } - - /** - * Sets up paths to establish connectivity between all internal - * BGP speakers and external BGP peers. - */ - private void setUpConnectivity() { - BgpConfig config = configService.getConfig(routerAppId, RoutingService.CONFIG_CLASS); - - if (config == null) { - log.warn("No BgpConfig found"); - return; - } - - Map<Key, PointToPointIntent> existingIntents = new HashMap<>(peerIntents); - - for (BgpConfig.BgpSpeakerConfig bgpSpeaker : config.bgpSpeakers()) { - log.debug("Start to set up BGP paths for BGP speaker: {}", - bgpSpeaker); - - buildSpeakerIntents(bgpSpeaker).forEach(i -> { - PointToPointIntent intent = existingIntents.remove(i.key()); - if (intent == null || !IntentUtils.equals(i, intent)) { - peerIntents.put(i.key(), i); - intentSynchronizer.submit(i); - } - }); - } - - // Remove any remaining intents that we used to have that we don't need - // anymore - existingIntents.values().forEach(i -> { - peerIntents.remove(i.key()); - intentSynchronizer.withdraw(i); - }); - } - - private Collection<PointToPointIntent> buildSpeakerIntents(BgpConfig.BgpSpeakerConfig speaker) { - List<PointToPointIntent> intents = new ArrayList<>(); - - for (IpAddress peerAddress : speaker.peers()) { - Interface peeringInterface = interfaceService.getMatchingInterface(peerAddress); - - if (peeringInterface == null) { - log.debug("No peering interface found for peer {} on speaker {}", - peerAddress, speaker); - continue; - } - - IpAddress peeringAddress = null; - for (InterfaceIpAddress address : peeringInterface.ipAddresses()) { - if (address.subnetAddress().contains(peerAddress)) { - peeringAddress = address.ipAddress(); - break; - } - } - - checkNotNull(peeringAddress); - - intents.addAll(buildIntents(speaker.connectPoint(), peeringAddress, - peeringInterface.connectPoint(), peerAddress)); - } - - return intents; - } - - /** - * Builds the required intents between the two pairs of connect points and - * IP addresses. - * - * @param portOne the first connect point - * @param ipOne the first IP address - * @param portTwo the second connect point - * @param ipTwo the second IP address - * @return the intents to install - */ - private Collection<PointToPointIntent> buildIntents(ConnectPoint portOne, - IpAddress ipOne, - ConnectPoint portTwo, - IpAddress ipTwo) { - - List<PointToPointIntent> intents = new ArrayList<>(); - - TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); - TrafficSelector selector; - Key key; - - byte tcpProtocol; - byte icmpProtocol; - - if (ipOne.isIp4()) { - tcpProtocol = IPv4.PROTOCOL_TCP; - icmpProtocol = IPv4.PROTOCOL_ICMP; - } else { - tcpProtocol = IPv6.PROTOCOL_TCP; - icmpProtocol = IPv6.PROTOCOL_ICMP6; - } - - // Path from BGP speaker to BGP peer matching destination TCP port 179 - selector = buildSelector(tcpProtocol, - ipOne, - ipTwo, - null, - BGP_PORT); - - key = buildKey(ipOne, ipTwo, SUFFIX_DST); - - intents.add(PointToPointIntent.builder() - .appId(appId) - .key(key) - .selector(selector) - .treatment(treatment) - .ingressPoint(portOne) - .egressPoint(portTwo) - .priority(PRIORITY_OFFSET) - .build()); - - // Path from BGP speaker to BGP peer matching source TCP port 179 - selector = buildSelector(tcpProtocol, - ipOne, - ipTwo, - BGP_PORT, - null); - - key = buildKey(ipOne, ipTwo, SUFFIX_SRC); - - intents.add(PointToPointIntent.builder() - .appId(appId) - .key(key) - .selector(selector) - .treatment(treatment) - .ingressPoint(portOne) - .egressPoint(portTwo) - .priority(PRIORITY_OFFSET) - .build()); - - // Path from BGP peer to BGP speaker matching destination TCP port 179 - selector = buildSelector(tcpProtocol, - ipTwo, - ipOne, - null, - BGP_PORT); - - key = buildKey(ipTwo, ipOne, SUFFIX_DST); - - intents.add(PointToPointIntent.builder() - .appId(appId) - .key(key) - .selector(selector) - .treatment(treatment) - .ingressPoint(portTwo) - .egressPoint(portOne) - .priority(PRIORITY_OFFSET) - .build()); - - // Path from BGP peer to BGP speaker matching source TCP port 179 - selector = buildSelector(tcpProtocol, - ipTwo, - ipOne, - BGP_PORT, - null); - - key = buildKey(ipTwo, ipOne, SUFFIX_SRC); - - intents.add(PointToPointIntent.builder() - .appId(appId) - .key(key) - .selector(selector) - .treatment(treatment) - .ingressPoint(portTwo) - .egressPoint(portOne) - .priority(PRIORITY_OFFSET) - .build()); - - // ICMP path from BGP speaker to BGP peer - selector = buildSelector(icmpProtocol, - ipOne, - ipTwo, - null, - null); - - key = buildKey(ipOne, ipTwo, SUFFIX_ICMP); - - intents.add(PointToPointIntent.builder() - .appId(appId) - .key(key) - .selector(selector) - .treatment(treatment) - .ingressPoint(portOne) - .egressPoint(portTwo) - .priority(PRIORITY_OFFSET) - .build()); - - // ICMP path from BGP peer to BGP speaker - selector = buildSelector(icmpProtocol, - ipTwo, - ipOne, - null, - null); - - key = buildKey(ipTwo, ipOne, SUFFIX_ICMP); - - intents.add(PointToPointIntent.builder() - .appId(appId) - .key(key) - .selector(selector) - .treatment(treatment) - .ingressPoint(portTwo) - .egressPoint(portOne) - .priority(PRIORITY_OFFSET) - .build()); - - return intents; - } - - /** - * Builds a traffic selector based on the set of input parameters. - * - * @param ipProto IP protocol - * @param srcIp source IP address - * @param dstIp destination IP address - * @param srcTcpPort source TCP port, or null if shouldn't be set - * @param dstTcpPort destination TCP port, or null if shouldn't be set - * @return the new traffic selector - */ - private TrafficSelector buildSelector(byte ipProto, IpAddress srcIp, - IpAddress dstIp, Short srcTcpPort, - Short dstTcpPort) { - TrafficSelector.Builder builder = DefaultTrafficSelector.builder().matchIPProtocol(ipProto); - - if (dstIp.isIp4()) { - builder.matchEthType(Ethernet.TYPE_IPV4) - .matchIPSrc(IpPrefix.valueOf(srcIp, IpPrefix.MAX_INET_MASK_LENGTH)) - .matchIPDst(IpPrefix.valueOf(dstIp, IpPrefix.MAX_INET_MASK_LENGTH)); - } else { - builder.matchEthType(Ethernet.TYPE_IPV6) - .matchIPv6Src(IpPrefix.valueOf(srcIp, IpPrefix.MAX_INET6_MASK_LENGTH)) - .matchIPv6Dst(IpPrefix.valueOf(dstIp, IpPrefix.MAX_INET6_MASK_LENGTH)); - } - - if (srcTcpPort != null) { - builder.matchTcpSrc(TpPort.tpPort(srcTcpPort)); - } - - if (dstTcpPort != null) { - builder.matchTcpDst(TpPort.tpPort(dstTcpPort)); - } - - return builder.build(); - } - - /** - * Builds an intent Key for a point-to-point intent based off the source - * and destination IP address, as well as a suffix String to distinguish - * between different types of intents between the same source and - * destination. - * - * @param srcIp source IP address - * @param dstIp destination IP address - * @param suffix suffix string - * @return intent key - */ - private Key buildKey(IpAddress srcIp, IpAddress dstIp, String suffix) { - String keyString = new StringBuilder() - .append(srcIp.toString()) - .append("-") - .append(dstIp.toString()) - .append("-") - .append(suffix) - .toString(); - - return Key.of(keyString, appId); - } - - private class InternalNetworkConfigListener implements NetworkConfigListener { - - @Override - public void event(NetworkConfigEvent event) { - switch (event.type()) { - case CONFIG_REGISTERED: - break; - case CONFIG_UNREGISTERED: - break; - case CONFIG_ADDED: - case CONFIG_UPDATED: - case CONFIG_REMOVED: - if (event.configClass() == RoutingService.CONFIG_CLASS) { - setUpConnectivity(); - } - break; - default: - break; - } - } - } - -} diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java deleted file mode 100644 index ace888d1..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.sdnip; - -import static org.slf4j.LoggerFactory.getLogger; - -import java.util.Objects; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onosproject.app.ApplicationService; -import org.onosproject.cluster.ClusterService; -import org.onosproject.cluster.ControllerNode; -import org.onosproject.cluster.LeadershipEvent; -import org.onosproject.cluster.LeadershipEventListener; -import org.onosproject.cluster.LeadershipService; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.CoreService; -import org.onosproject.incubator.net.intf.InterfaceService; -import org.onosproject.net.config.NetworkConfigService; -import org.onosproject.net.host.HostService; -import org.onosproject.net.intent.IntentService; -import org.onosproject.routing.IntentSynchronizationService; -import org.onosproject.routing.RoutingService; -import org.onosproject.routing.SdnIpService; -import org.onosproject.routing.config.RoutingConfigurationService; -import org.slf4j.Logger; - -/** - * Component for the SDN-IP peering application. - */ -@Component(immediate = true) -@Service -public class SdnIp implements SdnIpService { - - private static final String SDN_IP_APP = "org.onosproject.sdnip"; - private final Logger log = getLogger(getClass()); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected CoreService coreService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected IntentService intentService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected ApplicationService applicationService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected HostService hostService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected ClusterService clusterService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected LeadershipService leadershipService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected RoutingService routingService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected RoutingConfigurationService config; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected NetworkConfigService networkConfigService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected InterfaceService interfaceService; - - private IntentSynchronizer intentSynchronizer; - private PeerConnectivityManager peerConnectivity; - private SdnIpFib fib; - - private LeadershipEventListener leadershipEventListener = - new InnerLeadershipEventListener(); - private ApplicationId appId; - private ControllerNode localControllerNode; - - @Activate - protected void activate() { - log.info("SDN-IP started"); - - appId = coreService.registerApplication(SDN_IP_APP); - - localControllerNode = clusterService.getLocalNode(); - - intentSynchronizer = new IntentSynchronizer(appId, intentService); - intentSynchronizer.start(); - - peerConnectivity = new PeerConnectivityManager(appId, - intentSynchronizer, - networkConfigService, - coreService.getAppId(RoutingService.ROUTER_APP_ID), - interfaceService); - peerConnectivity.start(); - - fib = new SdnIpFib(appId, interfaceService, intentSynchronizer); - - routingService.addFibListener(fib); - routingService.start(); - - leadershipService.addListener(leadershipEventListener); - leadershipService.runForLeadership(appId.name()); - - applicationService.registerDeactivateHook(appId, - intentSynchronizer::removeIntents); - - } - - @Deactivate - protected void deactivate() { - routingService.stop(); - peerConnectivity.stop(); - intentSynchronizer.stop(); - - leadershipService.withdraw(appId.name()); - leadershipService.removeListener(leadershipEventListener); - - log.info("SDN-IP Stopped"); - } - - @Override - public void modifyPrimary(boolean isPrimary) { - intentSynchronizer.leaderChanged(isPrimary); - } - - @Override - public IntentSynchronizationService getIntentSynchronizationService() { - return intentSynchronizer; - } - - /** - * Converts DPIDs of the form xx:xx:xx:xx:xx:xx:xx to OpenFlow provider - * device URIs. - * - * @param dpid the DPID string to convert - * @return the URI string for this device - */ - static String dpidToUri(String dpid) { - return "of:" + dpid.replace(":", ""); - } - - /** - * A listener for Leadership Events. - */ - private class InnerLeadershipEventListener - implements LeadershipEventListener { - - @Override - public void event(LeadershipEvent event) { - log.debug("Leadership Event: time = {} type = {} event = {}", - event.time(), event.type(), event); - - if (!event.subject().topic().equals(appId.name())) { - return; // Not our topic: ignore - } - if (!Objects.equals(event.subject().leader(), localControllerNode.id())) { - return; // The event is not about this instance: ignore - } - - switch (event.type()) { - case LEADER_ELECTED: - log.info("SDN-IP Leader Elected"); - intentSynchronizer.leaderChanged(true); - break; - case LEADER_BOOTED: - log.info("SDN-IP Leader Lost Election"); - intentSynchronizer.leaderChanged(false); - break; - case LEADER_REELECTED: - break; - default: - break; - } - } - } -} diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java deleted file mode 100644 index 9113e013..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIpFib.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.sdnip; - -import com.google.common.collect.ImmutableList; -import org.onlab.packet.Ethernet; -import org.onlab.packet.IpAddress; -import org.onlab.packet.IpPrefix; -import org.onlab.packet.MacAddress; -import org.onlab.packet.VlanId; -import org.onosproject.core.ApplicationId; -import org.onosproject.incubator.net.intf.Interface; -import org.onosproject.incubator.net.intf.InterfaceService; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.flow.DefaultTrafficSelector; -import org.onosproject.net.flow.DefaultTrafficTreatment; -import org.onosproject.net.flow.TrafficSelector; -import org.onosproject.net.flow.TrafficTreatment; -import org.onosproject.net.intent.Constraint; -import org.onosproject.net.intent.Key; -import org.onosproject.net.intent.MultiPointToSinglePointIntent; -import org.onosproject.net.intent.constraint.PartialFailureConstraint; -import org.onosproject.routing.FibListener; -import org.onosproject.routing.FibUpdate; -import org.onosproject.routing.IntentSynchronizationService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import static com.google.common.base.Preconditions.checkArgument; - -/** - * FIB component of SDN-IP. - */ -public class SdnIpFib implements FibListener { - private Logger log = LoggerFactory.getLogger(getClass()); - - private static final int PRIORITY_OFFSET = 100; - private static final int PRIORITY_MULTIPLIER = 5; - protected static final ImmutableList<Constraint> CONSTRAINTS - = ImmutableList.of(new PartialFailureConstraint()); - - private final Map<IpPrefix, MultiPointToSinglePointIntent> routeIntents; - - private final ApplicationId appId; - private final InterfaceService interfaceService; - private final IntentSynchronizationService intentSynchronizer; - - /** - * Class constructor. - * - * @param appId application ID to use when generating intents - * @param interfaceService interface service - * @param intentSynchronizer intent synchronizer - */ - public SdnIpFib(ApplicationId appId, InterfaceService interfaceService, - IntentSynchronizationService intentSynchronizer) { - routeIntents = new ConcurrentHashMap<>(); - - this.appId = appId; - this.interfaceService = interfaceService; - this.intentSynchronizer = intentSynchronizer; - } - - - @Override - public void update(Collection<FibUpdate> updates, - Collection<FibUpdate> withdraws) { - int submitCount = 0, withdrawCount = 0; - // - // NOTE: Semantically, we MUST withdraw existing intents before - // submitting new intents. - // - synchronized (this) { - MultiPointToSinglePointIntent intent; - - // - // Prepare the Intent batch operations for the intents to withdraw - // - for (FibUpdate withdraw : withdraws) { - checkArgument(withdraw.type() == FibUpdate.Type.DELETE, - "FibUpdate with wrong type in withdraws list"); - - IpPrefix prefix = withdraw.entry().prefix(); - intent = routeIntents.remove(prefix); - if (intent == null) { - log.trace("SDN-IP No intent in routeIntents to delete " + - "for prefix: {}", prefix); - continue; - } - intentSynchronizer.withdraw(intent); - withdrawCount++; - } - - // - // Prepare the Intent batch operations for the intents to submit - // - for (FibUpdate update : updates) { - checkArgument(update.type() == FibUpdate.Type.UPDATE, - "FibUpdate with wrong type in updates list"); - - IpPrefix prefix = update.entry().prefix(); - intent = generateRouteIntent(prefix, update.entry().nextHopIp(), - update.entry().nextHopMac()); - - if (intent == null) { - // This preserves the old semantics - if an intent can't be - // generated, we don't do anything with that prefix. But - // perhaps we should withdraw the old intent anyway? - continue; - } - - routeIntents.put(prefix, intent); - intentSynchronizer.submit(intent); - submitCount++; - } - - log.debug("SDN-IP submitted {}/{}, withdrew = {}/{}", submitCount, - updates.size(), withdrawCount, withdraws.size()); - } - } - - /** - * Generates a route intent for a prefix, the next hop IP address, and - * the next hop MAC address. - * <p/> - * This method will find the egress interface for the intent. - * Intent will match dst IP prefix and rewrite dst MAC address at all other - * border switches, then forward packets according to dst MAC address. - * - * @param prefix IP prefix of the route to add - * @param nextHopIpAddress IP address of the next hop - * @param nextHopMacAddress MAC address of the next hop - * @return the generated intent, or null if no intent should be submitted - */ - private MultiPointToSinglePointIntent generateRouteIntent( - IpPrefix prefix, - IpAddress nextHopIpAddress, - MacAddress nextHopMacAddress) { - - // Find the attachment point (egress interface) of the next hop - Interface egressInterface = - interfaceService.getMatchingInterface(nextHopIpAddress); - if (egressInterface == null) { - log.warn("No outgoing interface found for {}", - nextHopIpAddress); - return null; - } - - // Generate the intent itself - Set<ConnectPoint> ingressPorts = new HashSet<>(); - ConnectPoint egressPort = egressInterface.connectPoint(); - log.debug("Generating intent for prefix {}, next hop mac {}", - prefix, nextHopMacAddress); - - for (Interface intf : interfaceService.getInterfaces()) { - // TODO this should be only peering interfaces - if (!intf.connectPoint().equals(egressInterface.connectPoint())) { - ConnectPoint srcPort = intf.connectPoint(); - ingressPorts.add(srcPort); - } - } - - // Match the destination IP prefix at the first hop - TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); - if (prefix.isIp4()) { - selector.matchEthType(Ethernet.TYPE_IPV4); - // if it is default route, then we do not need match destination - // IP address - if (prefix.prefixLength() != 0) { - selector.matchIPDst(prefix); - } - } else { - selector.matchEthType(Ethernet.TYPE_IPV6); - // if it is default route, then we do not need match destination - // IP address - if (prefix.prefixLength() != 0) { - selector.matchIPv6Dst(prefix); - } - - } - - // Rewrite the destination MAC address - TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder() - .setEthDst(nextHopMacAddress); - if (!egressInterface.vlan().equals(VlanId.NONE)) { - treatment.setVlanId(egressInterface.vlan()); - // If we set VLAN ID, we have to make sure a VLAN tag exists. - // TODO support no VLAN -> VLAN routing - selector.matchVlanId(VlanId.ANY); - } - - int priority = - prefix.prefixLength() * PRIORITY_MULTIPLIER + PRIORITY_OFFSET; - Key key = Key.of(prefix.toString(), appId); - return MultiPointToSinglePointIntent.builder() - .appId(appId) - .key(key) - .selector(selector.build()) - .treatment(treatment.build()) - .ingressPoints(ingressPorts) - .egressPoint(egressPort) - .priority(priority) - .constraints(CONSTRAINTS) - .build(); - } - -} diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/AddPeerCommand.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/AddPeerCommand.java deleted file mode 100644 index 81231ab9..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/AddPeerCommand.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.sdnip.cli; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.onlab.packet.IpAddress; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.CoreService; -import org.onosproject.incubator.net.intf.InterfaceService; -import org.onosproject.net.config.NetworkConfigService; -import org.onosproject.routing.RoutingService; -import org.onosproject.routing.config.BgpConfig; - -/** - * Command to add new BGP peer to existing internal speaker. - */ -@Command(scope = "onos", name = "add-bgp-peer", - description = "Adds an external BGP router as peer to an existing BGP speaker") -public class AddPeerCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "name", - description = "Name of the internal BGP speaker", - required = true, multiValued = false) - String name = null; - - @Argument(index = 1, name = "ip", - description = "IP address of the BGP peer", - required = true, multiValued = false) - String ip = null; - - private static final String PEER_ADD_SUCCESS = "Peer Successfully Added."; - private static final String NO_CONFIGURATION = "No speakers configured"; - private static final String SPEAKER_NOT_FOUND = - "Speaker with name \'%s\' not found"; - private static final String NO_INTERFACE = - "No matching interface found for IP \'%s\'"; - - private IpAddress peerAddress = null; - - @Override - protected void execute() { - peerAddress = IpAddress.valueOf(ip); - - NetworkConfigService configService = get(NetworkConfigService.class); - CoreService coreService = get(CoreService.class); - ApplicationId appId = coreService.getAppId(RoutingService.ROUTER_APP_ID); - - BgpConfig config = configService.getConfig(appId, BgpConfig.class); - if (config == null || config.bgpSpeakers().isEmpty()) { - print(NO_CONFIGURATION); - return; - } - - BgpConfig.BgpSpeakerConfig speaker = config.getSpeakerWithName(name); - if (speaker == null) { - print(SPEAKER_NOT_FOUND, name); - return; - } else { - if (speaker.isConnectedToPeer(peerAddress)) { - return; // Peering already exists. - } - } - - InterfaceService interfaceService = get(InterfaceService.class); - if (interfaceService.getMatchingInterface(peerAddress) == null) { - print(NO_INTERFACE, ip); - return; - } - - addPeerToSpeakerConf(config); - configService.applyConfig(appId, BgpConfig.class, config.node()); - - print(PEER_ADD_SUCCESS); - } - - private void addPeerToSpeakerConf(BgpConfig config) { - log.debug("Creating BGP configuration for new peer: {}", ip); - config.addPeerToSpeaker(name, peerAddress); - } -} diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/AddSpeakerCommand.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/AddSpeakerCommand.java deleted file mode 100644 index 84353852..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/AddSpeakerCommand.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.sdnip.cli; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.onlab.packet.IpAddress; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.CoreService; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.config.NetworkConfigService; -import org.onosproject.routing.RoutingService; -import org.onosproject.routing.config.BgpConfig; - -import java.util.HashSet; -import java.util.Optional; - -/** - * Command to add a new internal BGP speaker. - */ -@Command(scope = "onos", name = "add-bgp-speaker", - description = "Adds an internal BGP speaker") -public class AddSpeakerCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "name", - description = "Name of the internal BGP speaker", - required = true, multiValued = false) - String name = null; - - @Argument(index = 1, name = "connectionPoint", - description = "Interface to the BGP speaker", - required = true, multiValued = false) - String connectionPoint = null; - - private static final String SPEAKER_ADD_SUCCESS = "Speaker Successfully Added."; - - @Override - protected void execute() { - NetworkConfigService configService = get(NetworkConfigService.class); - CoreService coreService = get(CoreService.class); - ApplicationId appId = coreService.getAppId(RoutingService.ROUTER_APP_ID); - - BgpConfig config = configService.addConfig(appId, BgpConfig.class); - - BgpConfig.BgpSpeakerConfig speaker = config.getSpeakerWithName(name); - if (speaker != null) { - log.debug("Speaker already exists: {}", name); - return; - } - - addSpeakerToConf(config); - configService.applyConfig(appId, BgpConfig.class, config.node()); - - print(SPEAKER_ADD_SUCCESS); - } - - /** - * Adds the speaker to the BgpConfig service. - * - * @param config the BGP configuration - */ - private void addSpeakerToConf(BgpConfig config) { - log.debug("Adding new speaker to configuration: {}", name); - BgpConfig.BgpSpeakerConfig speaker = getSpeaker(); - - config.addSpeaker(speaker); - } - - private BgpConfig.BgpSpeakerConfig getSpeaker() { - ConnectPoint connectPoint = ConnectPoint. - deviceConnectPoint(connectionPoint); - return new BgpConfig.BgpSpeakerConfig(Optional.ofNullable(name), - connectPoint, new HashSet<IpAddress>()); - } -} diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/PrimaryChangeCommand.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/PrimaryChangeCommand.java deleted file mode 100644 index 7a17cfe0..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/PrimaryChangeCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.sdnip.cli; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.routing.SdnIpService; - -/** - * Command to change whether this SDNIP instance is primary or not. - */ -@Command(scope = "onos", name = "sdnip-set-primary", - description = "Changes the primary status of this SDN-IP instance") -public class PrimaryChangeCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "isPrimary", - description = "True if this instance should be primary, false if not", - required = true, multiValued = false) - boolean isPrimary = false; - - @Override - protected void execute() { - get(SdnIpService.class).modifyPrimary(isPrimary); - } - -} diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/RemovePeerCommand.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/RemovePeerCommand.java deleted file mode 100644 index bfc6fb7b..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/RemovePeerCommand.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.sdnip.cli; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.onlab.packet.IpAddress; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.CoreService; -import org.onosproject.net.config.NetworkConfigService; -import org.onosproject.routing.RoutingService; -import org.onosproject.routing.config.BgpConfig; - -/** - * Command to remove existing BGP peer. - */ -@Command(scope = "onos", name = "remove-bgp-peer", - description = "Removes a BGP peer") -public class RemovePeerCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "ip", - description = "IP address of the BGP peer", - required = true, multiValued = false) - String ip = null; - - private static final String PEER_REMOVE_SUCCESS = "Peer Successfully Removed."; - private static final String NO_CONFIGURATION = "No speakers configured"; - private static final String PEER_NOT_FOUND = - "Peer with IP \'%s\' not found"; - - private IpAddress peerAddress = null; - - @Override - protected void execute() { - peerAddress = IpAddress.valueOf(ip); - - NetworkConfigService configService = get(NetworkConfigService.class); - CoreService coreService = get(CoreService.class); - ApplicationId appId = coreService.getAppId(RoutingService.ROUTER_APP_ID); - - BgpConfig config = configService.getConfig(appId, BgpConfig.class); - if (config == null || config.bgpSpeakers().isEmpty()) { - print(NO_CONFIGURATION); - return; - } - - peerAddress = IpAddress.valueOf(ip); - - BgpConfig.BgpSpeakerConfig speaker = config.getSpeakerFromPeer(peerAddress); - if (speaker == null) { - print(PEER_NOT_FOUND, ip); - return; - } - - removePeerFromSpeakerConf(speaker, config); - configService.applyConfig(appId, BgpConfig.class, config.node()); - - print(PEER_REMOVE_SUCCESS); - } - - private void removePeerFromSpeakerConf(BgpConfig.BgpSpeakerConfig speaker, - BgpConfig config) { - log.debug("Removing BGP configuration for peer: {}", ip); - config.removePeerFromSpeaker(speaker, peerAddress); - } -} diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/RemoveSpeakerCommand.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/RemoveSpeakerCommand.java deleted file mode 100644 index 6a51b42f..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/RemoveSpeakerCommand.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.sdnip.cli; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.CoreService; -import org.onosproject.net.config.NetworkConfigService; -import org.onosproject.routing.RoutingService; -import org.onosproject.routing.config.BgpConfig; - -/** - * Command to remove a internal BGP speaker. - */ -@Command(scope = "onos", name = "remove-bgp-speaker", - description = "Removes an internal BGP speaker") -public class RemoveSpeakerCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "name", - description = "Name of the internal BGP speaker", - required = true, multiValued = false) - String name = null; - - private static final String SPEAKER_REMOVE_SUCCESS = "Speaker Successfully Removed."; - private static final String NO_CONFIGURATION = "No speakers configured"; - private static final String PEERS_EXIST = - "Speaker with name \'%s\' has peer connections"; - private static final String SPEAKER_NOT_FOUND = - "Speaker with name \'%s\' not found"; - - @Override - protected void execute() { - NetworkConfigService configService = get(NetworkConfigService.class); - CoreService coreService = get(CoreService.class); - ApplicationId appId = coreService.getAppId(RoutingService.ROUTER_APP_ID); - - BgpConfig config = configService.getConfig(appId, BgpConfig.class); - if (config == null || config.bgpSpeakers().isEmpty()) { - print(NO_CONFIGURATION); - return; - } - - BgpConfig.BgpSpeakerConfig speaker = config.getSpeakerWithName(name); - if (speaker == null) { - print(SPEAKER_NOT_FOUND, name); - return; - } else { - if (!speaker.peers().isEmpty()) { - // Removal not allowed when peer connections exist. - print(PEERS_EXIST, name); - return; - } - } - - removeSpeakerFromConf(config); - configService.applyConfig(appId, BgpConfig.class, config.node()); - - print(SPEAKER_REMOVE_SUCCESS); - } - - /** - * Removes the speaker from the BgpConfig service. - * - * @param bgpConfig the BGP configuration - */ - private void removeSpeakerFromConf(BgpConfig bgpConfig) { - log.debug("Removing speaker from configuration: {}", name); - - bgpConfig.removeSpeaker(name); - } -} diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/package-info.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/package-info.java deleted file mode 100644 index 73ea2a4f..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * SDN-IP command-line handlers. - */ -package org.onosproject.sdnip.cli; diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/package-info.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/package-info.java deleted file mode 100644 index 1e7d8cb9..00000000 --- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * SDN-IP peering application. - */ -package org.onosproject.sdnip; diff --git a/framework/src/onos/apps/sdnip/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/framework/src/onos/apps/sdnip/src/main/resources/OSGI-INF/blueprint/shell-config.xml deleted file mode 100644 index 97b2f09f..00000000 --- a/framework/src/onos/apps/sdnip/src/main/resources/OSGI-INF/blueprint/shell-config.xml +++ /dev/null @@ -1,35 +0,0 @@ -<!-- - ~ Copyright 2014 Open Networking Laboratory - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> - - <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0"> - <command> - <action class="org.onosproject.sdnip.cli.PrimaryChangeCommand"/> - </command> - <command> - <action class="org.onosproject.sdnip.cli.AddSpeakerCommand"/> - </command> - <command> - <action class="org.onosproject.sdnip.cli.RemoveSpeakerCommand"/> - </command> - <command> - <action class="org.onosproject.sdnip.cli.AddPeerCommand"/> - </command> - <command> - <action class="org.onosproject.sdnip.cli.RemovePeerCommand"/> - </command> - </command-bundle> -</blueprint> diff --git a/framework/src/onos/apps/sdnip/src/main/resources/config-examples/README b/framework/src/onos/apps/sdnip/src/main/resources/config-examples/README deleted file mode 100644 index 7642a4dd..00000000 --- a/framework/src/onos/apps/sdnip/src/main/resources/config-examples/README +++ /dev/null @@ -1,5 +0,0 @@ -The SDN-IP configuration files should be copied to directory - $ONOS_HOME/tools/package/config - -After deployment and starting up the ONOS cluster, ONOS looks for these -configuration files in /opt/onos/config on each cluster member. diff --git a/framework/src/onos/apps/sdnip/src/main/resources/config-examples/sdnip.json b/framework/src/onos/apps/sdnip/src/main/resources/config-examples/sdnip.json deleted file mode 100644 index c51de68a..00000000 --- a/framework/src/onos/apps/sdnip/src/main/resources/config-examples/sdnip.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "bgpPeers" : [ - { - "attachmentDpid" : "00:00:00:00:00:00:00:a3", - "attachmentPort" : "1", - "ipAddress" : "192.168.10.1" - }, - { - "attachmentDpid" : "00:00:00:00:00:00:00:a5", - "attachmentPort" : "1", - "ipAddress" : "192.168.20.1" - }, - { - "attachmentDpid" : "00:00:00:00:00:00:00:a2", - "attachmentPort" : "1", - "ipAddress" : "192.168.30.1" - }, - { - "attachmentDpid" : "00:00:00:00:00:00:00:a6", - "attachmentPort" : "1", - "ipAddress" : "192.168.40.1" - }, - { - "attachmentDpid" : "00:00:00:00:00:00:00:a4", - "attachmentPort" : "4", - "ipAddress" : "192.168.60.1" - } - ], - "bgpSpeakers" : [ - { - "name" : "bgpSpeaker1", - "attachmentDpid" : "00:00:00:00:00:00:00:a1", - "attachmentPort" : "1", - "macAddress" : "00:00:00:00:00:01", - "interfaceAddresses" : [ - { - "interfaceDpid" : "00:00:00:00:00:00:00:a3", - "interfacePort" : "1", - "ipAddress" : "192.168.10.101" - }, - { - "interfaceDpid" : "00:00:00:00:00:00:00:a5", - "interfacePort" : "1", - "ipAddress" : "192.168.20.101" - }, - { - "interfaceDpid" : "00:00:00:00:00:00:00:a2", - "interfacePort" : "1", - "ipAddress" : "192.168.30.101" - }, - { - "interfaceDpid" : "00:00:00:00:00:00:00:a6", - "interfacePort" : "1", - "ipAddress" : "192.168.40.101" - }, - { - "interfaceDpid" : "00:00:00:00:00:00:00:a4", - "interfacePort" : "4", - "ipAddress" : "192.168.60.101" - } - - ] - - } - ], - "ip4LocalPrefixes" : [ - { - "ipPrefix" : "100.0.0.0/24", - "type" : "PUBLIC", - "gatewayIp" : "100.0.0.1" - }, - { - "ipPrefix" : "200.0.0.0/8", - "type" : "PUBLIC", - "gatewayIp" : "200.0.0.3" - }, - { - "ipPrefix" : "192.0.0.0/24", - "type" : "PRIVATE", - "gatewayIp" : "192.0.0.254" - } - ], - "ip6LocalPrefixes" : [ - ], - "virtualGatewayMacAddress" : "00:00:00:00:00:01" -} |