sunish vk
Committed by Gerrit Code Review

OSPF-API refactored based on review comments, ONOS-2738,

Change-Id: I05d39f7f0d6b3a2d0cc51a256feec220f1d0e06a
Showing 27 changed files with 2766 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-ospf</artifactId>
<version>1.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>onos-ospf-api</artifactId>
<packaging>bundle</packaging>
<description>ONOS Ospf controller subsystem API</description>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
org.onosproject.ospf.*
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.Ip4Address;
import java.util.List;
/**
* Representation of an OSPF device information.
*/
public interface DeviceInformation {
/**
* Gets router id.
*
* @return router id
*/
Ip4Address routerId();
/**
* Sets router id.
*
* @param routId router id
*/
void setRouterId(Ip4Address routId);
/**
* Gets device id.
*
* @return device id
*/
Ip4Address deviceId();
/**
* Sets device id.
*
* @param deviceId device id
*/
void setDeviceId(Ip4Address deviceId);
/**
* Gets list of interface ids.
*
* @return list of interface ids
*/
List<Ip4Address> interfaceId();
/**
* Adds interface id to list.
*
* @param interfaceId interface id
*/
void addInterfaceId(Ip4Address interfaceId);
/**
* Gets area id.
*
* @return area id
*/
Ip4Address areaId();
/**
* Sets area id.
*
* @param areaId area id
*/
void setAreaId(Ip4Address areaId);
/**
* Gets device information is already created or not.
*
* @return true if device information is already created else false
*/
boolean isAlreadyCreated();
/**
* Sets device information is already created or not.
*
* @param alreadyCreated true if device information is already created else false
*/
void setAlreadyCreated(boolean alreadyCreated);
/**
* Gets device is dr or not.
*
* @return true if device is dr else false
*/
boolean isDr();
/**
* Sets device is dr or not.
*
* @param dr true if device is dr else false
*/
void setDr(boolean dr);
/**
* Gets neighbor id.
*
* @return neighbor id
*/
Ip4Address neighborId();
/**
* Sets neighbor id.
*
* @param neighborId neighbor id
*/
void setNeighborId(Ip4Address neighborId);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.Ip4Address;
/**
* Representation of an OSPF link information.
*/
public interface LinkInformation {
/**
* Gets link id.
*
* @return link id
*/
String linkId();
/**
* Sets link id.
*
* @param linkId link id
*/
void setLinkId(String linkId);
/**
* Gets link information is already created or not.
*
* @return true if link information is already created else false
*/
boolean isAlreadyCreated();
/**
* Sets link information is already created or not.
*
* @param alreadyCreated true if link information is already created else false
*/
void setAlreadyCreated(boolean alreadyCreated);
/**
* Gets is link source id is same as router id or not.
*
* @return true if link source id is not same as router id else false
*/
boolean isLinkSrcIdNotRouterId();
/**
* Sets is link source id is same as router id or not.
*
* @param linkSrcIdNotRouterId true if link source id is not same as router id else false
*/
void setLinkSrcIdNotRouterId(boolean linkSrcIdNotRouterId);
/**
* Gets link destination id.
*
* @return link destination id
*/
Ip4Address linkDestinationId();
/**
* Sets link destination id.
*
* @param linkDestinationId link destination id
*/
void setLinkDestinationId(Ip4Address linkDestinationId);
/**
* Gets link source id.
*
* @return link source id
*/
Ip4Address linkSourceId();
/**
* Sets link source id.
*
* @param linkSourceId link source id
*/
void setLinkSourceId(Ip4Address linkSourceId);
/**
* Gets interface ip address.
*
* @return interface ip address
*/
Ip4Address interfaceIp();
/**
* Sets interface ip address.
*
* @param interfaceIp interface ip address
*/
void setInterfaceIp(Ip4Address interfaceIp);
/**
* Gets link source ip address.
*
* @return link source ip address
*/
Ip4Address linkSourceIpAddress();
/**
* Sets link source ip address.
*
* @param linkSourceIpAddress link source ip address
*/
void setLinkSourceIpAddress(Ip4Address linkSourceIpAddress);
/**
* Gets link destination ip address.
*
* @return link destination ip address
*/
Ip4Address linkDestinationIpAddress();
/**
* Sets link destination ip address.
*
* @param linkDestinationIpAddress link destination ip address
*/
void setLinkDestinationIpAddress(Ip4Address linkDestinationIpAddress);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import java.util.Map;
/**
* Representation of a bin where an LSA is stored for aging.
* A bin is identified by a bin number and can have one or more LSAs
* stored in a particular bin location.
*/
public interface LsaBin {
/**
* Adds the given LSA to this bin with the given key.
*
* @param lsaKey key of the stored LSA
* @param lsaWrapper wrapper instance to store
*/
public void addOspfLsa(String lsaKey, LsaWrapper lsaWrapper);
/**
* Retrieves the LSA from the bin for verification of max age and ls refresh.
*
* @param lsaKey key to search the LSA
* @return LSA Wrapper instance
*/
public LsaWrapper ospfLsa(String lsaKey);
/**
* Removes the given LSA from the bin. when ever it reaches max age or ls refresh time.
*
* @param lsaKey key to search LSA
* @param lsaWrapper wrapper instance of the particular LSA
*/
public void removeOspfLsa(String lsaKey, LsaWrapper lsaWrapper);
/**
* Gets the list of LSAs in this bin as key value pair.
* with key being the LSA key formed from the LSA header.
*
* @return list of LSAs in this bin as key value pair
*/
public Map<String, LsaWrapper> listOfLsa();
/**
* Gets the bin number assigned during the initialization process of the bins .
*
* @return the bin number
*/
public int binNumber();
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
/**
* Representation of a wrapper object to store LSA and associated metadata.
* Metadata consists about the origination of LSA, age of LSA when received etc.
*/
public interface LsaWrapper {
/**
* Gets the type of LSA, it can be a router,network,summary,external.
*
* @return lsa type
*/
public OspfLsaType lsaType();
/**
* Sets the LSA type during the initialization of wrapper.
*
* @param lsaType lsa type
*/
public void setLsaType(OspfLsaType lsaType);
/**
* Determines the origination of LSA , this is called during ls refresh interval.
*
* @return true if self originated else false
*/
public boolean isSelfOriginated();
/**
* Sets is self originated or not.
*
* @param isSelfOriginated true if self originated else false
*/
public void setIsSelfOriginated(boolean isSelfOriginated);
/**
* Age of LSA when received during the adjacency formation.
*
* @return Age of LSA when received
*/
public int lsaAgeReceived();
/**
* Sets the Age of LSA when received during the adjacency formation.
*
* @param lsaAgeReceived Age of LSA when received
*/
public void setLsaAgeReceived(int lsaAgeReceived);
/**
* Gets the LSA present in the wrapper instance.
*
* @return LSA instance
*/
public OspfLsa ospfLsa();
/**
* Sets the LSA instance to the wrapper.
*
* @param ospfLsa LSA instance
*/
public void setOspfLsa(OspfLsa ospfLsa);
/**
* Gets the current LSA Age, using this we calculate current age.
* It is done against the age counter which is incremented every second.
*
* @return lsa age
*/
public int currentAge();
/**
* Gets the age counter when received.
*
* @return the age counter when received
*/
public int ageCounterWhenReceived();
/**
* Sets the age counter when received.
*
* @param ageCounterWhenReceived the age counter when received
*/
public void setAgeCounterWhenReceived(int ageCounterWhenReceived);
/**
* Gets the LSA process command, like max age, ls refresh, based on the command set.
* The queue consumer will pick the LSA and start performing the actions, like flooding
* out of the domain or generating a new LSA and flooding.
*
* @return lsa process command
*/
public String lsaProcessing();
/**
* Sets the LSA process command, like max age , ls refresh , based on the command set.
* The queue consumer will pick the LSA and start performing the actions, like flooding
* out of the domain or generating a new LSA and flooding.
*
* @param lsaProcessing lsa process command
*/
public void setLsaProcessing(String lsaProcessing);
/**
* Gets bin number into which the LSA wrapper is put for aging process.
*
* @return bin number
*/
public int binNumber();
/**
* Sets bin number into which the LSA wrapper is put for aging process.
*
* @param binNumber bin number
*/
public void setBinNumber(int binNumber);
/**
* Gets the interface on which the LSA was received.
*
* @return the interface instance
*/
public OspfInterface ospfInterface();
/**
* Sets the interface on which the LSA was received, this is used later to flood the information.
*
* @param ospfInterface interface instance
*/
public void setOspfInterface(OspfInterface ospfInterface);
/**
* Sets the LSDB age.
* Using LSDB age we are calculating age of a particular LSA.
*
* @param lsdbAge lsdbAge instance
*/
public void setLsdbAge(LsdbAge lsdbAge);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
/**
* Representation of LSDB aging process.
* The age of each LSA in the database must be incremented by 1 each second.
* We put all the LSAs of a given age into a single bin. The age of an LSA is the
* difference between its age bin and the bin representing LS age 0.
*/
public interface LsdbAge {
/**
* Adds LSA to bin for aging.
*
* @param binKey key to store the LSA in bin
* @param lsaBin LSA bin instance
*/
public void addLsaBin(Integer binKey, LsaBin lsaBin);
/**
* Gets LSA from bin, this method is used while processing ls refresh and max age on LSA.
*
* @param binKey key to retreive the LSA from bin
* @return lsaBin bin instance
*/
public LsaBin getLsaBin(Integer binKey);
/**
* Adds the lsa to maxAge bin if LSAs age is max age.
*
* @param key key to store the LSA in bin.
* @param wrapper wrapper instance which contains LSA
*/
public void addLsaToMaxAgeBin(String key, LsaWrapper wrapper);
/**
* Gets the bin number out of LSAs age, in which the LSA can be placed.
* so that age can be calculated.
*
* @param x Can be either age or ageCounter
* @return bin number.
*/
public int age2Bin(int x);
/**
* Gets the max age bin, a special bin is created which holds only max age LSAs.
*
* @return lsa bin instance
*/
public LsaBin getMaxAgeBin();
/**
* Gets the age counter.
*
* @return age counter
*/
public int getAgeCounter();
/**
* Refresh the LSAs which are in the refresh bin.
*/
public void refreshLsa();
/**
* If the LSAs have completed the MaxAge stop aging and flood it.
*/
public void maxAgeLsa();
/**
* Invoked every 1 second as part of the aging process, and increments age counter.
* It also verifies if any LSA has reached ls refresh time or max age.
*/
public void ageLsaAndFlood();
/**
* Starts the aging timer thread which gets invokes every second.
*/
public void startDbAging();
/**
* Removes LSA from Bin, when ever it reaches a max age or ls refresh time.
*
* @param lsaWrapper wrapper instance
*/
public void removeLsaFromBin(LsaWrapper lsaWrapper);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
/**
* Representation of an OSPF agent.
* It is responsible for keeping track of the current set of routers
* connected to the system.
*/
public interface OspfAgent {
/**
* Adds a router that has just connected to the system.
*
* @param ospfRouter the router id to add
* @return true if added, false otherwise
*/
boolean addConnectedRouter(OspfRouter ospfRouter);
/**
* Removes the router which got disconnected from the system.
*
* @param ospfRouter the router id to remove
*/
void removeConnectedRouter(OspfRouter ospfRouter);
/**
* Notifies that got a packet of link from network and need do processing.
*
* @param ospfRouter router instance
* @param ospfLinkTed link ted instance
*/
void addLink(OspfRouter ospfRouter, OspfLinkTed ospfLinkTed);
/**
* Notifies that got a packet of link from network and need do processing.
*
* @param ospfRouter router instance
*/
void deleteLink(OspfRouter ospfRouter);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.Ip4Address;
import java.util.List;
/**
* Representation of an OSPF area. OSPF areas are collections of network segments.
* The configuration of OSPF area consists of assigning an area id to each network segment.
* Each area has its own link state database.
*/
public interface OspfArea {
/**
* Gets the router id associated with the area.
*
* @return router id
*/
Ip4Address routerId();
/**
* Sets the router id for this area.
*
* @param routerId router's ip address
*/
void setRouterId(Ip4Address routerId);
/**
* Gets the area id.
*
* @return area id
*/
Ip4Address areaId();
/**
* Sets the area id.
*
* @param areaId area id as an IPv4 address
*/
void setAreaId(Ip4Address areaId);
/**
* Gets the LSDB instance for this area.
*
* @return LSDB instance for this area
*/
public OspfLsdb database();
/**
* Checks whether an instance of the given LSA exists in the database.
*
* @param lookupLsa LSA instance to lookup
* @return LSA wrapper instance which contains the LSA
*/
public LsaWrapper lsaLookup(OspfLsa lookupLsa);
/**
* Initializes link state database, this acts as a place holder for storing the received LSA.
*/
public void initializeDb();
/**
* Sets the stub cost.
*
* @param stubCost stub cost
*/
void setStubCost(int stubCost);
/**
* Sets the options value.
*
* @param options integer value
*/
void setOptions(int options);
/**
* Gets area address ranges to which this area belongs to.
*
* @return list of area address ranges
*/
List<OspfAreaAddressRange> addressRanges();
/**
* Sets the area address ranges to which this area belongs to.
*
* @param addrRangeList list of area address ranges
*/
void setAddressRanges(List<OspfAreaAddressRange> addrRangeList);
/**
* Gets whether the area is transit capable or not.
* This indicates whether the area can carry data traffic that neither originates
* nor terminates in the area itself.
*
* @return true if transit capable, else false
*/
boolean isTransitCapability();
/**
* Sets whether the area is transit capable or not.
* This indicates whether the area can carry data traffic that neither originates
* nor terminates in the area itself.
*
* @param transitCapability true if transit capable, else false
*/
void setTransitCapability(boolean transitCapability);
/**
* Gets external routing capability.
* This indicates Whether AS-external-LSAs will be flooded into/throughout the area.
*
* @return true if external routing capable, else false
*/
boolean isExternalRoutingCapability();
/**
* Sets external routing capability.
* This indicates Whether AS-external-LSAs will be flooded into/throughout the area.
*
* @param externalRoutingCapability true if external routing capable, else false
*/
void setExternalRoutingCapability(boolean externalRoutingCapability);
/**
* Gets the stub cost, which indicates if the area has been configured as a stub area.
*
* @return stub cost
*/
int stubCost();
/**
* Gets if the router is opaque enabled or not.
* This indicates whether the router accepts opaque LSA.
*
* @return true if opaque enabled else false
*/
boolean isOpaqueEnabled();
/**
* Gets the list of interfaces attached to this area.
*
* @return list of interfaces
*/
List<OspfInterface> getInterfacesLst();
/**
* Sets the list of interfaces attached to this area.
*
* @param interfacesLst list of interface instances
*/
void setInterfacesLst(List<OspfInterface> interfacesLst);
/**
* Gets the options value, which indicates the supported optional capabilities.
*
* @return options value
*/
int options();
/**
* Gets the opaque enabled options value, which indicates support of opaque capabilities.
*
* @return opaque enabled options value
*/
int opaqueEnabledOptions();
/**
* Sets opaque enabled to true or false, which indicates whether the router accepts opaque LSA.
*
* @param isOpaqueEnable true if opaque enabled else false
*/
void setIsOpaqueEnabled(boolean isOpaqueEnable);
/**
* Refreshes areas, by sending a router LSA and network LSA (in case of DR).
* with a new sequence number.
*
* @param ospfInterface interface instance
* @throws Exception might throw exception
*/
void refreshArea(OspfInterface ospfInterface) throws Exception;
/**
* Verifies no neighbor is in exchange process.
*
* @return boolean indicating that there is no Neighbor in Database Exchange
*/
boolean noNeighborInLsaExchangeProcess();
/**
* Checks whether an instance of the given LSA exists in the database belonging to this area.
* If so return true else false.
*
* @param lsa1 LSA instance to compare
* @param lsa2 LSA instance to compare
* @return "same" if both instances are same, "latest" if lsa1 is latest, or "old" if lsa1 is old
*/
String isNewerOrSameLsa(OspfLsa lsa1, OspfLsa lsa2);
/**
* Whenever we receive an LSA with max age - we put it in the max age bin.
* This is later used to flush LSAs out of the routing domain.
*
* @param key key to add it to LSDB
* @param wrapper LSA wrapper instance
*/
void addLsaToMaxAgeBin(String key, LsaWrapper wrapper);
/**
* Whenever an LSA is being flushed out or reaches max age, it must be stopped from aging.
* This achieved by removing it from bin.
*
* @param lsaWrapper the LSA wrapper instance to delete
*/
void removeLsaFromBin(LsaWrapper lsaWrapper);
/**
* Adds the received LSA to LSDB, this method creates an LSA wrapper for the LSA.
* Also adds it to the LSDB of the area. This method is specifically called for
* the self originated LSAs.
*
* @param ospfLsa LSA instance
* @param isSelfOriginated true if the LSA is self originated else false
* @param ospfInterface interface instance
* @throws Exception might throws exception
*/
void addLsa(OspfLsa ospfLsa, boolean isSelfOriginated, OspfInterface ospfInterface)
throws Exception;
/**
* Adds the received LSA to LSDB,this method creates an LSA wrapper for the LSA.
* Adds it to the LSDB of the area.
*
* @param ospfLsa LSA instance
* @param ospfInterface interface instance
* @throws Exception might throws exception
*/
void addLsa(OspfLsa ospfLsa, OspfInterface ospfInterface) throws Exception;
/**
* Sets router sequence number for router LSA.
*
* @param newSequenceNumber sequence number
*/
void setDbRouterSequenceNumber(long newSequenceNumber);
/**
* Gets LSA header of all types of LSAs present in the link state database.
*
* @param excludeMaxAgeLsa need to include(true) or exclude(false) max age LSA
* @param isOpaqueCapable need to include(true) or exclude(false) type 10 Opaque LSA
* @return list of LSA header in the LSDB
*/
List getLsaHeaders(boolean excludeMaxAgeLsa, boolean isOpaqueCapable);
/**
* Gets the LSA wrapper from link state database based on the parameters passed.
*
* @param lsType type of LSA to form the key
* @param linkStateID link state id to form the key
* @param advertisingRouter advertising router to form the key
* @return LSA wrapper instance which contains the LSA
* @throws Exception might throws exception
*/
LsaWrapper getLsa(int lsType, String linkStateID, String advertisingRouter) throws Exception;
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.Ip4Address;
/**
* Represents the collection of IP addresses contained in the address range.
*/
public interface OspfAreaAddressRange {
/**
* Gets the IP address.
*
* @return IP address
*/
public Ip4Address ipAddress();
/**
* Sets the IP address.
*
* @param ipAddress IPv4 address
*/
public void setIpAddress(Ip4Address ipAddress);
/**
* Gets the network mask.
*
* @return network mask
*/
public String mask();
/**
* Sets the network mask.
*
* @param mask network mask
*/
public void setMask(String mask);
/**
* Gets the advertise value, which indicates routing information is condensed at area boundaries.
*
* @return advertise true if advertise flag is set else false
*/
public boolean isAdvertise();
/**
* Sets the advertise value, which indicates routing information is condensed at area boundaries.
*
* @param advertise true if advertise flag to set else false
*/
public void setAdvertise(boolean advertise);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import java.util.List;
import java.util.Set;
/**
* Abstraction of an OSPF controller.
* Serves as a one stop shop for obtaining OSPF devices and (un)register listeners on OSPF events.
*/
public interface OspfController {
/**
* Registers a listener for router meta events.
*
* @param listener the listener to notify
*/
void addRouterListener(OspfRouterListener listener);
/**
* Unregisters a router listener.
*
* @param listener the listener to unregister
*/
void removeRouterListener(OspfRouterListener listener);
/**
* Registers a listener for OSPF message events.
*
* @param listener the listener to notify
*/
void addLinkListener(OspfLinkListener listener);
/**
* Unregisters a link listener.
*
* @param listener the listener to unregister
*/
void removeLinkListener(OspfLinkListener listener);
/**
* Updates configuration of processes.
*
* @param processes process info to update
*/
public void updateConfig(List<OspfProcess> processes);
/**
* Deletes configuration parameters.
*
* @param processes list of process instance
* @param attribute attribute to delete
*/
public void deleteConfig(List<OspfProcess> processes, String attribute);
/**
* Gets string representation of area configuration parameters to be displayed after CLI command.
*
* @param processId process Id
* @param areaId area Id
* @return Area Information
*/
public String showAreaParameters(String processId, String areaId);
/**
* Gets string representation of area configuration information for the given area/process.
* This method will be called for CLI command.
*
* @param processId process id to which area belongs
* @param areaId area id
* @return string representation of area configuration for CLI display
*/
List<String> showAreaConfigurations(String processId, String areaId);
/**
* Gets the list of listeners registered for router events.
*
* @return list of listeners
*/
Set<OspfRouterListener> listener();
/**
* Gets the list of listeners registered for link events.
*
* @return list of listeners
*/
public Set<OspfLinkListener> linkListener();
/**
* Gets the configured process.
*
* @return list of process instances
*/
public List<OspfProcess> getAllConfiguredProcesses();
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import java.util.List;
/**
* Represents Device Traffic Engineering parameters.
*/
public interface OspfDeviceTed {
/**
* Obtain list of IPv4 router ids.
*
* @return IPv4 router ids
*/
public List<Ip4Address> ipv4RouterIds();
/**
* Sets list of IPv4 router ids.
*
* @param routerIds list of IPv4 router ids
*/
public void setIpv4RouterIds(List<Ip4Address> routerIds);
/**
* Obtain list of IPv6 router id.
*
* @return IPv4 router ids
*/
public List<Ip6Address> ipv6RouterIds();
/**
* Sets list of IPv4 router ids.
*
* @param routerIds list of IPv4 router ids
*/
public void setIpv6RouterIds(List<Ip6Address> routerIds);
/**
* Obtain the list of topology ids.
*
* @return list of topology ids
*/
public List<Short> topologyIds();
/**
* Sets the list of topology ids.
*
* @param topologyIds the list of topology ids
*/
public void setTopologyIds(List<Short> topologyIds);
/**
* Obtains position of device in the network.
*
* @return position of device in the network
*/
public Boolean asbr();
/**
* Sets position of device in the network.
*
* @param asbr position of device in the network
*/
public void setAsbr(Boolean asbr);
/**
* Obtains position of device in the network.
*
* @return position of device in the network
*/
public Boolean abr();
/**
* Sets position of device in the network.
*
* @param abr position of device in the network
*/
public void setAbr(Boolean abr);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.Ip4Address;
import java.util.HashMap;
/**
* Represents an OSPF Interface.
*/
public interface OspfInterface {
/**
* Gets network mask of the interface.
*
* @return network mask
*/
Ip4Address ipNetworkMask();
/**
* Sets area id, to which the interface belongs.
*
* @param areaId area identifier
*/
void setAreaId(int areaId);
/**
* Sets the authentication key.
* Interface uses this to authenticate while establishing communication with other routers.
*
* @param authKey represents authentication key
*/
void setAuthKey(String authKey);
/**
* Sets the authentication type,
* Interface uses this to authenticate while establishing communication with other routers.
*
* @param authType authType represents authentication type
*/
void setAuthType(String authType);
/**
* Sets the value of BDR.
* The BDR is calculated during adjacency formation.
*
* @param bdr backup designated router's IP address
*/
void setBdr(Ip4Address bdr);
/**
* Sets the value of DR.
* The DR is calculated during adjacency formation.
*
* @param dr designated router's IP address
*/
void setDr(Ip4Address dr);
/**
* Sets the hello interval time.
* It is the interval at which a hello packet is sent out via this interface.
*
* @param helloIntervalTime an integer interval time
*/
void setHelloIntervalTime(int helloIntervalTime);
/**
* Sets router dead interval time.
* This is the interval after which this interface will trigger a process to kill neighbor.
*
* @param routerDeadIntervalTime an integer interval time
*/
void setRouterDeadIntervalTime(int routerDeadIntervalTime);
/**
* Sets the interface cost which is the cost of sending a data packet onto the network.
*
* @param interfaceCost an integer represents interface cost
*/
void setInterfaceCost(int interfaceCost);
/**
* Sets interface type.
* This indicates whether the interface is on point to point mode or broadcast mode.
*
* @param interfaceType an integer represents interface type
*/
void setInterfaceType(int interfaceType);
/**
* Sets IP Address of this interface.
*
* @param ipAddress IP address
*/
void setIpAddress(Ip4Address ipAddress);
/**
* Sets IP network mask.
*
* @param ipNetworkMask network mask
*/
void setIpNetworkMask(Ip4Address ipNetworkMask);
/**
* Sets the polling interval.
* Polling interval indicates the interval until when the Hello Packets are
* sent to a dead neighbor.
*
* @param pollInterval an integer represents poll interval
*/
void setPollInterval(int pollInterval);
/**
* Sets transmission delay.
*
* @param transmitDelay an integer represents delay
*/
void setTransmitDelay(int transmitDelay);
/**
* Sets retransmit interval which indicates the number of seconds between LSA retransmissions.
*
* @param reTransmitInterval an integer represents interval
*/
void setReTransmitInterval(int reTransmitInterval);
/**
* Sets MTU.
*
* @param mtu an integer represents max transfer unit
*/
void setMtu(int mtu);
/**
* Sets router priority.
*
* @param routerPriority value
*/
void setRouterPriority(int routerPriority);
/**
* Gets the area id to which router belongs.
*
* @return areaId an integer value
*/
int areaId();
/**
* Gets the IP address.
*
* @return an string represents IP address
*/
Ip4Address ipAddress();
/**
* Gets the interface type.
*
* @return an integer represents interface type
*/
int interfaceType();
/**
* Gets the MTU.
*
* @return an integer representing max transfer unit
*/
int mtu();
/**
* Gets interface cost.
*
* @return an integer representing interface cost
*/
int interfaceCost();
/**
* Gets the list of neighbors associated with the interface.
*
* @return listOfNeighbors as key value pair
*/
HashMap<String, OspfNbr> listOfNeighbors();
/**
* Gets poll interval.
*
* @return pollInterval an integer representing poll interval
*/
int pollInterval();
/**
* Gets transmission delay.
*
* @return transmitDelay an integer representing delay
*/
int transmitDelay();
/**
* Gets the IP address of the BDR.
*
* @return bdr BDR's IP address
*/
Ip4Address bdr();
/**
* Gets the ip address of the DR..
*
* @return dr DR's IP address
*/
Ip4Address dr();
/**
* Gets authentication key.
*
* @return authKey represents authentication key
*/
String authKey();
/**
* Gets authentication type.
*
* @return authType represents authentication type
*/
String authType();
/**
* Gets hello interval time in seconds, this defines how often we send the hello packet.
*
* @return hello interval time in seconds
*/
int helloIntervalTime();
/**
* Gets retransmit interval.
*
* @return reTransmitInterval an integer represents interval
*/
int reTransmitInterval();
/**
* Gets router dead interval time.
* This defines how long we should wait for hello packets before we declare the neighbor is dead.
*
* @return routerDeadIntervalTime an integer interval time
*/
int routerDeadIntervalTime();
/**
* Gets router priority.
*
* @return routerPriority value
*/
int routerPriority();
/**
* Adds the given neighboring router to the neighbor map.
*
* @param ospfNbr neighbor instance
*/
void addNeighbouringRouter(OspfNbr ospfNbr);
/**
* Gets the neighbor instance from listOfNeighbors map for the given neighbor ID.
*
* @param neighborId neighbors id
* @return ospfNbr neighbor instance
*/
OspfNbr neighbouringRouter(String neighborId);
/**
* Checks the given neighbor is in the neighbor list.
*
* @param neighborId neighbors id
* @return true if neighbor in list else false
*/
boolean isNeighborInList(String neighborId);
/**
* Removes LSA headers from the map in which LSA headers are stored.
*
* @param lsaKey key used to store lsa in map
*/
void removeLsaFromNeighborMap(String lsaKey);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.IpAddress;
import java.util.List;
/**
* Abstraction of an OSPF Link.
*/
public interface OspfLink {
/**
* Gets IP address of the Router.
*
* @return IP address of router
*/
IpAddress remoteRouterId();
/**
* Gets the area id for this device.
*
* @return the area id
*/
int areaIdOfInterface();
/**
* Gets IP address of the interface.
*
* @return IP address of the interface
*/
IpAddress interfaceIp();
/**
* Gets list of the link TED.
*
* @return list of the link TED
*/
List<OspfLinkTed> linkTedLists();
/**
* Sets IP address of the router.
*
* @param routerIp router's IP address
*/
void setRouterIp(IpAddress routerIp);
/**
* Sets the area id for this device.
*
* @param areaIdOfInterface area id
*/
void setAreaIdOfInterface(int areaIdOfInterface);
/**
* Sets IP address of the interface.
*
* @param interfaceIp IP address of the interface.
*/
void setInterfaceIp(IpAddress interfaceIp);
/**
* Sets list of the link TED.
*
* @param linkTedLists list of the link TED
*/
void setLinkTedLists(List<OspfLinkTed> linkTedLists);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
/**
* Abstraction of an OSPF link listener.
*/
public interface OspfLinkListener {
/**
* Notifies that we got a link from network.
*
* @param ospfRouter router instance
* @param ospfLinkTed link TED information of router
*/
void addLink(OspfRouter ospfRouter, OspfLinkTed ospfLinkTed);
/**
* Notifies that a link got removed from network.
*
* @param ospfRouter router instance
*/
void deleteLink(OspfRouter ospfRouter);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import org.onlab.util.Bandwidth;
import java.util.List;
/**
* Represents OSPF Link Traffic Engineering parameters.
*/
public interface OspfLinkTed {
/**
* Provides maximum bandwidth can be used on the link.
*
* @return maximum bandwidth
*/
public Bandwidth maximumLink();
/**
* Sets maximum band width.
*
* @param bandwidth maximum bandwidth
*/
public void setMaximumLink(Bandwidth bandwidth);
/**
* Amount of bandwidth reservable on the link.
*
* @return unreserved bandwidth
*/
public List<Bandwidth> maxUnResBandwidth();
/**
* Sets max bandwidth that is not reserved on the link.
*
* @param bandwidth max bandwidth that is not reserved on the link
*/
public void setMaxUnResBandwidth(Bandwidth bandwidth);
/**
* Provides max bandwidth that can be reserved on the link.
*
* @return max bandwidth reserved
*/
public Bandwidth maxReserved();
/**
* Sets max bandwidth that can be reserved on the link.
*
* @param bandwidth max bandwidth that can be reserved on the link
*/
public void setMaxReserved(Bandwidth bandwidth);
/**
* Provides Traffic Engineering metric for the link.
*
* @return Traffic Engineering metric
*/
public Integer teMetric();
/**
* Sets Traffic Engineering metric for the link.
*
* @param teMetric Traffic Engineering metric for the link
*/
public void setTeMetric(Integer teMetric);
/**
* Provides IPv4 router-Id of local node.
*
* @return IPv4 router-Id of local node
*/
public List<Ip4Address> ipv4LocRouterId();
/**
* Sets IPv4 router-Id of local node.
*
* @param routerIds IPv4 router-Id of local node
*/
public void setIpv4LocRouterId(List<Ip4Address> routerIds);
/**
* Provides IPv6 router-Id of local node.
*
* @return IPv6 router-Id of local node
*/
public List<Ip6Address> ipv6LocRouterId();
/**
* Sets IPv6 router-Id of local node.
*
* @param routerIds IPv6 router-Id of local node
*/
public void setIpv6LocRouterId(List<Ip6Address> routerIds);
/**
* Provides IPv4 router-Id of remote node.
*
* @return IPv4 router-Id of remote node
*/
public List<Ip4Address> ipv4RemRouterId();
/**
* Sets IPv4 router-Id of remote node.
*
* @param routerIds IPv4 router-Id of remote node
*/
public void setIpv4RemRouterId(List<Ip4Address> routerIds);
/**
* Provides IPv6 router-Id of remote node.
*
* @return IPv6 router-Id of remote node
*/
public List<Ip6Address> ipv6RemRouterId();
/**
* Sets IPv6 router-Id of remote node.
*
* @param routerIds IPv6 router-Id of remote node
*/
public void setIpv6RemRouterId(List<Ip6Address> routerIds);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
/**
* Represents an OSPF LSA.
*/
public interface OspfLsa {
/**
* Gets the type of OSPF LSA.
*
* @return OSPF LSA type instance
*/
OspfLsaType getOspfLsaType();
/**
* Gets the age of LSA.
*
* @return age of LSA
*/
int age();
/**
* Gets the LSA header instance.
*
* @return this instance
*/
public OspfLsa lsaHeader();
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
/**
* Represents OSPF LSA types.
*/
public enum OspfLsaType {
ROUTER(1),
NETWORK(2),
SUMMARY(3),
ASBR_SUMMARY(4),
EXTERNAL_LSA(5),
LINK_LOCAL_OPAQUE_LSA(9),
AREA_LOCAL_OPAQUE_LSA(10),
AS_OPAQUE_LSA(11),
UNDEFINED(20);
private int value;
/**
* Creates an instance of OSPF LSA type.
*
* @param value represents LSA type
*/
OspfLsaType(int value) {
this.value = value;
}
/**
* Gets the value representing LSA type.
*
* @return value represents LSA type
*/
public int value() {
return value;
}
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import java.util.List;
/**
* Represents an OSPF link state database.
*/
public interface OspfLsdb {
/**
* Initializes the link state database.
*/
public void initializeDb();
/**
* Gets all LSA headers.
*
* @param excludeMaxAgeLsa exclude the max age LSAs
* @param isOpaqueCapable is opaque capable or not
* @return List of LSA headers
*/
public List getAllLsaHeaders(boolean excludeMaxAgeLsa, boolean isOpaqueCapable);
/**
* Finds the LSA from appropriate LSA maps.
*
* @param lsType type of LSA
* @param lsaKey key
* @return LSA wrapper object
*/
public LsaWrapper findLsa(int lsType, String lsaKey);
/**
* Adds the LSA to maxAge bin.
*
* @param key key
* @param lsaWrapper LSA wrapper instance
*/
public void addLsaToMaxAgeBin(String key, Object lsaWrapper);
/**
* Removes LSA from bin.
*
* @param lsaWrapper LSA wrapper instance
*/
public void removeLsaFromBin(Object lsaWrapper);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.jboss.netty.channel.Channel;
import org.onlab.packet.Ip4Address;
import java.util.Map;
/**
* Represents an OSPF neighbor.
*/
public interface OspfNbr {
/**
* Gets neighbor's id.
*
* @return neighbor's id
*/
public Ip4Address neighborId();
/**
* Gets router priority.
*
* @return router priority
*/
public int routerPriority();
/**
* Gets the IP address of this neighbor.
*
* @return the IP address of this neighbor
*/
public Ip4Address neighborIpAddr();
/**
* Gets the neighbor's DR address.
*
* @return neighbor's DR address
*/
public Ip4Address neighborDr();
/**
* Gets the neighbor's BDR address.
*
* @return neighbor's BDR address
*/
Ip4Address neighborBdr();
/**
* Determines whether an adjacency should be established/maintained with the neighbor.
*
* @param ch netty channel instance
*/
void adjOk(Channel ch);
/**
* Gets the pending re transmit list as a map.
*
* @return pending re transmit list as a map
*/
Map<String, OspfLsa> getPendingReTxList();
/**
* Sets the neighbor's id.
*
* @param neighborId neighbor's id
*/
void setNeighborId(Ip4Address neighborId);
/**
* Sets the neighbor's BDR address.
*
* @param neighborBdr neighbor's BDR address
*/
void setNeighborBdr(Ip4Address neighborBdr);
/**
* Sets the neighbor's DR address.
*
* @param neighborDr neighbor's DR address
*/
void setNeighborDr(Ip4Address neighborDr);
/**
* Sets router priority.
*
* @param routerPriority router priority
*/
void setRouterPriority(int routerPriority);
/**
* Sets the neighbor is opaque enabled or not.
*
* @param isOpaqueCapable true if the neighbor is opaque enabled else false
*/
void setIsOpaqueCapable(boolean isOpaqueCapable);
/**
* Sets neighbor is master or not.
*
* @param isMaster neighbor is master or not
*/
void setIsMaster(int isMaster);
/**
* Gets the DD sequence number.
*
* @return DD sequence number
*/
long ddSeqNum();
/**
* Sets the DD sequence number.
*
* @param ddSeqNum DD sequence number
*/
void setDdSeqNum(long ddSeqNum);
/**
* Gets neighbor is master or not.
*
* @return true if neighbor is master else false
*/
int isMaster();
/**
* Gets the options value.
*
* @return options value
*/
int options();
/**
* Sets the options value.
*
* @param options options value
*/
void setOptions(int options);
/**
* An invalid request for LSA has been received.
* This indicates an error in the Database Exchange process. Actions to be performed
* are the same as in seqNumMismatch. In addition, stop the possibly activated
* retransmission timer.
*
* @param ch netty channel instance
* @throws Exception might throw exception
*/
void badLSReq(Channel ch) throws Exception;
/**
* Gets the LS request list.
*
* @return LS request list
*/
Map getLsReqList();
/**
* Gets the reTxList instance.
*
* @return reTxList instance
*/
Map getReTxList();
/**
* Gets if the neighbor is opaque enabled or not.
*
* @return true if the neighbor is opaque enabled else false.
*/
public boolean isOpaqueCapable();
/**
* Gets the neighbor's state.
*
* @return neighbor's state
*/
OspfNeighborState getState();
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
/**
* Enum representing OSPF neighbor state.
*/
public enum OspfNeighborState {
DOWN(1),
ATTEMPT(2),
INIT(3),
TWOWAY(4),
EXSTART(5),
EXCHANGE(6),
LOADING(7),
FULL(8);
private int value;
/**
* Creates an OSPF neighbor state.
*
* @param value represents neighbors state
*/
OspfNeighborState(int value) {
this.value = value;
}
/**
* Gets value of neighbor state.
*
* @return value represents neighbors state
*/
public int getValue() {
return value;
}
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import java.util.List;
/**
* Represents an OSPF Process.
*/
public interface OspfProcess {
/**
* Gets the list of areas belonging to this process.
*
* @return list of areas belonging to this process
*/
public List<OspfArea> areas();
/**
* Sets the list of areas belonging to this process.
*
* @param areas list of areas belonging to this process
*/
public void setAreas(List<OspfArea> areas);
/**
* Gets the process id.
*
* @return process id
*/
public String processId();
/**
* Sets the process id.
*
* @param processId the process id
*/
public void setProcessId(String processId);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.Ip4Address;
/**
* Abstraction of an OSPF Router.
*/
public interface OspfRouter {
/**
* Gets IP address of the router.
*
* @return IP address of the router
*/
Ip4Address routerIp();
/**
* Gets the area id for this device.
*
* @return the area id for this device
*/
Ip4Address areaIdOfInterface();
/**
* Gets IP address of the interface.
*
* @return IP address of the interface
*/
Ip4Address interfaceId();
/**
* Gets list of device TED.
*
* @return list of device TED.
*/
OspfDeviceTed deviceTed();
/**
* Sets IP address of the Router.
*
* @param routerIp IP address of the router
*/
void setRouterIp(Ip4Address routerIp);
/**
* Sets area id in which this device belongs to.
*
* @param areaIdOfInterface area id in which this device belongs to
*/
void setAreaIdOfInterface(Ip4Address areaIdOfInterface);
/**
* Sets IP address of the interface.
*
* @param interfaceId IP address of the interface
*/
void setInterfaceId(Ip4Address interfaceId);
/**
* Sets the device TED information.
*
* @param deviceTed device TED instance
*/
void setDeviceTed(OspfDeviceTed deviceTed);
/**
* Gets if router is opaque enabled.
*
* @return true if router is opaque enabled else false.
*/
boolean isOpaque();
/**
* Sets true if device is opaque enable if not sets false.
*
* @param opaque true if device is opaque enable if not sets false
*/
void setOpaque(boolean opaque);
/**
* Gets IP address of the advertising router.
*
* @return IP address of the advertising router
*/
Ip4Address neighborRouterId();
/**
* Sets IP address of the advertising router.
*
* @param advertisingRouterId IP address of the advertising router
*/
void setNeighborRouterId(Ip4Address advertisingRouterId);
/**
* Gets if the router id DR or not.
*
* @return true if the router is DR else false
*/
boolean isDr();
/**
* Sets if the router id DR or not.
*
* @param dr true if the router is DR else false
*/
void setDr(boolean dr);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.IpAddress;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkArgument;
/**
* Represents an OSPF router id.
*/
public class OspfRouterId {
private static final String SCHEME = "ospf";
private static final long UNKNOWN = 0;
private final IpAddress ipAddress;
/**
* Creates an instance of OSPF router id.
*
* @param ipAddress IP address of the router
*/
public OspfRouterId(IpAddress ipAddress) {
this.ipAddress = ipAddress;
}
/**
* Creates an instance from ip address.
*
* @param ipAddress IP address
* @return OSPF router id instance
*/
public static OspfRouterId ospfRouterId(IpAddress ipAddress) {
return new OspfRouterId(ipAddress);
}
/**
* Creates OSPF router id instance from the URI.
*
* @param uri device URI
* @return OSPF router id instance
*/
public static OspfRouterId ospfRouterId(URI uri) {
checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme");
return new OspfRouterId(IpAddress.valueOf(uri.getSchemeSpecificPart()));
}
/**
* Returns device URI from the given router id.
*
* @param ospfRouterId router id instance
* @return device URI
*/
public static URI uri(OspfRouterId ospfRouterId) {
return uri(ospfRouterId.ipAddress());
}
/**
* Returns device URI from the given IP address.
*
* @param ipAddress device IP address
* @return device URI
*/
public static URI uri(IpAddress ipAddress) {
try {
return new URI(SCHEME, ipAddress.toString(), null);
} catch (URISyntaxException e) {
return null;
}
}
/**
* Returns the IP address.
*
* @return IP address
*/
public IpAddress ipAddress() {
return ipAddress;
}
@Override
public String toString() {
return ipAddress.toString();
}
@Override
public boolean equals(Object other) {
if (!(other instanceof OspfRouterId)) {
return false;
}
OspfRouterId otherOspfRouterId = (OspfRouterId) other;
return Objects.equals(ipAddress, otherOspfRouterId.ipAddress);
}
@Override
public int hashCode() {
return Objects.hash(ipAddress);
}
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
/**
* Abstraction of an OSPF Router Listener.
* Allows for providers interested in switch events to be notified.
*/
public interface OspfRouterListener {
/**
* Notifies that a router is added.
*
* @param ospfRouter OSPF router instance
*/
void routerAdded(OspfRouter ospfRouter);
/**
* Notifies that a router is removed.
*
* @param ospfRouter OSPF router instance
*/
void routerRemoved(OspfRouter ospfRouter);
/**
* Notifies that the router has changed in some way.
*
* @param ospfRouter OSPF router instance
*/
void routerChanged(OspfRouter ospfRouter);
}
\ No newline at end of file
/*
* Copyright 2016 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.ospf.controller;
import org.onlab.packet.Ip4Address;
import java.util.List;
import java.util.Map;
/**
* Represents IP topology for OSPF device and link details.
*/
public interface TopologyForDeviceAndLink {
/**
* Gets the device information.
*
* @return device information
*/
Map<String, DeviceInformation> deviceInformationMap();
/**
* Sets the device information.
*
* @param key key used to store in map
* @param deviceInformationMap device information instance
*/
void setDeviceInformationMap(String key, DeviceInformation deviceInformationMap);
/**
* Gets the link information.
*
* @return link information
*/
Map<String, LinkInformation> linkInformationMap();
/**
* Sets link information.
*
* @param key key used to store in map
* @param linkInformationMap link information instance
*/
void setLinkInformationMap(String key, LinkInformation linkInformationMap);
/**
* Removes link information.
*
* @param key key used to remove from map
*/
void removeLinkInformationMap(String key);
/**
* Adds device information.
*
* @param ospfLsa LSA instance
* @param ospfInterface interface instance
* @param ospfArea area instance
*/
void addLocalDevice(OspfLsa ospfLsa, OspfInterface ospfInterface, OspfArea ospfArea);
/**
* Removes device information.
*
* @param key key used to remove from map
*/
void removeDeviceInformationMap(String key);
/**
* Removes links from linkInformationMap.
*
* @param routerId router's IP address
*/
void removeLinks(Ip4Address routerId);
/**
* Gets OSPF link TED details.
*
* @param key key used to retrieve from map
* @return links TED information
*/
OspfLinkTed getOspfLinkTedHashMap(String key);
/**
* Gets all the router information to be deleted.
*
* @param ospfLsa LSA instance
* @param ospfArea area instance
* @return list of router information which needs to delete from device list
*/
List<String> getDeleteRouterInformation(OspfLsa ospfLsa, OspfArea ospfArea);
/**
* Updates the device and link information.
*
* @param ospfLsa LSA instance
* @param ospfArea area instance
*/
void updateLinkInformation(OspfLsa ospfLsa, OspfArea ospfArea);
}
\ No newline at end of file
/*
* Copyright 2016 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.
*/
/**
* Implementation of the ospf api interfaces.
*/
package org.onosproject.ospf.controller;
\ No newline at end of file
package org.onosproject.ospf.controller;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onlab.packet.IpAddress;
import java.net.URI;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit test class for OspfRouterId.
*/
public class OspfRouterIdTest {
private OspfRouterId ospfRouterId;
@Before
public void setUp() throws Exception {
ospfRouterId = new OspfRouterId(IpAddress.valueOf("2.2.2.2"));
}
@After
public void tearDown() throws Exception {
ospfRouterId = null;
}
/**
* Tests constructor.
*/
@Test
public void testOspfRouterId() throws Exception {
assertThat(OspfRouterId.ospfRouterId(IpAddress.valueOf("2.2.2.2")), instanceOf(OspfRouterId.class));
}
/**
* Tests ipAddress() getter method.
*/
@Test
public void testIpAddress() throws Exception {
assertThat(ospfRouterId.ipAddress(), instanceOf(IpAddress.class));
}
/**
* Tests to string method.
*/
@Test
public void testToString() throws Exception {
assertThat(ospfRouterId.toString(), is(notNullValue()));
}
/**
* Tests equals() method.
*/
@Test
public void testEquals() throws Exception {
assertThat(ospfRouterId.equals(new OspfRouterId(IpAddress.valueOf("3.3.3.3"))), is(false));
}
/**
* Tests hashCode() method.
*/
@Test
public void testHashCode() throws Exception {
assertThat(ospfRouterId.hashCode(), is(notNullValue()));
}
/**
* Tests constructor.
*/
@Test
public void testOspfRouterId1() throws Exception {
assertThat(OspfRouterId.ospfRouterId(OspfRouterId.uri(ospfRouterId)), instanceOf(OspfRouterId.class));
}
/**
* Tests uri() method.
*/
@Test
public void testUri() throws Exception {
assertThat(OspfRouterId.uri(IpAddress.valueOf("2.2.2.2")), instanceOf(URI.class));
}
/**
* Tests uri() method..
*/
@Test
public void testUri1() throws Exception {
assertThat(OspfRouterId.uri(ospfRouterId), instanceOf(URI.class));
}
}
\ No newline at end of file