Committed by
Gerrit Code Review
ONOS-2740,ONOS-2741,from ONOS-3032 - to ONOS 3071 , OSPF Protocol Implementation
Change-Id: Ie8cccca4aaf2641ab1e332ed367ddfc9b725a35c
Showing
14 changed files
with
669 additions
and
0 deletions
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.ospf.controller.area; | ||
| 17 | + | ||
| 18 | +import com.google.common.base.MoreObjects; | ||
| 19 | +import org.onosproject.ospf.controller.OspfProcess; | ||
| 20 | + | ||
| 21 | +import java.util.List; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * Representation of an OSPF configuration data. | ||
| 25 | + */ | ||
| 26 | +public class Configuration { | ||
| 27 | + private List<OspfProcess> processes; | ||
| 28 | + private String method; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Gets the configured processes. | ||
| 32 | + * | ||
| 33 | + * @return list of configured processes. | ||
| 34 | + */ | ||
| 35 | + public List<OspfProcess> getProcesses() { | ||
| 36 | + return processes; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * Sets the configured processes. | ||
| 41 | + * | ||
| 42 | + * @param processes configured processes | ||
| 43 | + */ | ||
| 44 | + public void setProcesses(List<OspfProcess> processes) { | ||
| 45 | + this.processes = processes; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * Gets whether to update, add or delete configuration. | ||
| 50 | + * | ||
| 51 | + * @return update, add or delete configuration | ||
| 52 | + */ | ||
| 53 | + public String getMethod() { | ||
| 54 | + return method; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * Sets whether to update, add or delete configuration. | ||
| 59 | + * | ||
| 60 | + * @param method configuration method. | ||
| 61 | + */ | ||
| 62 | + public void setMethod(String method) { | ||
| 63 | + this.method = method; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public String toString() { | ||
| 69 | + return MoreObjects.toStringHelper(getClass()) | ||
| 70 | + .omitNullValues() | ||
| 71 | + .add("method", method) | ||
| 72 | + .add("processes", processes) | ||
| 73 | + .toString(); | ||
| 74 | + } | ||
| 75 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfAreaAddressRangeImpl.java
0 → 100755
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.ospf.controller.area; | ||
| 17 | + | ||
| 18 | +import com.google.common.base.MoreObjects; | ||
| 19 | +import com.google.common.base.Objects; | ||
| 20 | +import org.onlab.packet.Ip4Address; | ||
| 21 | +import org.onosproject.ospf.controller.OspfAreaAddressRange; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * Representation of an area address ranges. | ||
| 25 | + * Address ranges are used in order to aggregate routing information at area boundaries. | ||
| 26 | + * Each address range is specified by an [address,mask] pair and a status indication of | ||
| 27 | + * either advertise or do not advertise | ||
| 28 | + */ | ||
| 29 | +public class OspfAreaAddressRangeImpl implements OspfAreaAddressRange { | ||
| 30 | + | ||
| 31 | + public Ip4Address ipAddress; | ||
| 32 | + public String mask; | ||
| 33 | + public boolean advertise; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * Gets the IP address. | ||
| 37 | + * | ||
| 38 | + * @return IP address | ||
| 39 | + */ | ||
| 40 | + public Ip4Address ipAddress() { | ||
| 41 | + return ipAddress; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Sets the IP address. | ||
| 46 | + * | ||
| 47 | + * @param ipAddress IP address | ||
| 48 | + */ | ||
| 49 | + public void setIpAddress(Ip4Address ipAddress) { | ||
| 50 | + this.ipAddress = ipAddress; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * Gets the network mask. | ||
| 55 | + * | ||
| 56 | + * @return network mask | ||
| 57 | + */ | ||
| 58 | + public String mask() { | ||
| 59 | + return mask; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * Sets the network mask. | ||
| 64 | + * | ||
| 65 | + * @param mask network mask value | ||
| 66 | + */ | ||
| 67 | + public void setMask(String mask) { | ||
| 68 | + this.mask = mask; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * Gets the advertise value. | ||
| 73 | + * | ||
| 74 | + * @return advertise value | ||
| 75 | + */ | ||
| 76 | + public boolean isAdvertise() { | ||
| 77 | + return advertise; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * Sets the advertise value. | ||
| 82 | + * | ||
| 83 | + * @param advertise advertise value | ||
| 84 | + */ | ||
| 85 | + public void setAdvertise(boolean advertise) { | ||
| 86 | + this.advertise = advertise; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + @Override | ||
| 90 | + public boolean equals(Object other) { | ||
| 91 | + if (!(other instanceof OspfAreaAddressRangeImpl)) { | ||
| 92 | + return false; | ||
| 93 | + } | ||
| 94 | + OspfAreaAddressRangeImpl otherAreaAddressRange = (OspfAreaAddressRangeImpl) other; | ||
| 95 | + return Objects.equal(ipAddress, otherAreaAddressRange.ipAddress) && | ||
| 96 | + Objects.equal(mask, otherAreaAddressRange.mask) && | ||
| 97 | + Objects.equal(advertise, otherAreaAddressRange.advertise); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @Override | ||
| 101 | + public int hashCode() { | ||
| 102 | + return Objects.hashCode(ipAddress, mask, advertise); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @Override | ||
| 106 | + public String toString() { | ||
| 107 | + return MoreObjects.toStringHelper(getClass()) | ||
| 108 | + .omitNullValues() | ||
| 109 | + .add("ipAddress", ipAddress) | ||
| 110 | + .add("mask", mask) | ||
| 111 | + .add("advertise", advertise) | ||
| 112 | + .toString(); | ||
| 113 | + } | ||
| 114 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java
0 → 100755
This diff is collapsed. Click to expand it.
protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfProcessImpl.java
0 → 100755
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.ospf.controller.area; | ||
| 17 | + | ||
| 18 | +import com.fasterxml.jackson.annotation.JsonProperty; | ||
| 19 | +import com.google.common.base.MoreObjects; | ||
| 20 | +import org.onosproject.ospf.controller.OspfArea; | ||
| 21 | +import org.onosproject.ospf.controller.OspfProcess; | ||
| 22 | + | ||
| 23 | +import java.util.List; | ||
| 24 | + | ||
| 25 | +/** | ||
| 26 | + * Representation of the configuration data for OSPF Process, which will be configured using rest URI. | ||
| 27 | + */ | ||
| 28 | +public class OspfProcessImpl implements OspfProcess { | ||
| 29 | + | ||
| 30 | + private String processId; | ||
| 31 | + private List<OspfArea> areas; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * Gets the list of areas belonging to this process. | ||
| 35 | + * | ||
| 36 | + * @return list of areas belonging to this process | ||
| 37 | + */ | ||
| 38 | + public List<OspfArea> areas() { | ||
| 39 | + return areas; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * Sets the list of areas belonging to this process. | ||
| 44 | + * | ||
| 45 | + * @param areas list of areas belonging to this process | ||
| 46 | + */ | ||
| 47 | + @JsonProperty("areas") | ||
| 48 | + public void setAreas(List<OspfArea> areas) { | ||
| 49 | + this.areas = areas; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * Gets the process id. | ||
| 54 | + * | ||
| 55 | + * @return process id | ||
| 56 | + */ | ||
| 57 | + public String processId() { | ||
| 58 | + return processId; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * Sets the process id. | ||
| 63 | + * | ||
| 64 | + * @param processId the process id | ||
| 65 | + */ | ||
| 66 | + @JsonProperty("processId") | ||
| 67 | + public void setProcessId(String processId) { | ||
| 68 | + this.processId = processId; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + @Override | ||
| 72 | + public String toString() { | ||
| 73 | + return MoreObjects.toStringHelper(getClass()) | ||
| 74 | + .omitNullValues() | ||
| 75 | + .add("areas", areas) | ||
| 76 | + .toString(); | ||
| 77 | + } | ||
| 78 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * Implementation of the OSPF controller. | ||
| 19 | + */ | ||
| 20 | +package org.onosproject.ospf.controller.area; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * Implementation of the OSPF controller. | ||
| 19 | + */ | ||
| 20 | +package org.onosproject.ospf.controller.impl; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.ospf.controller.lsdb; | ||
| 17 | + | ||
| 18 | +import com.google.common.base.MoreObjects; | ||
| 19 | +import org.onosproject.ospf.controller.LsaBin; | ||
| 20 | +import org.onosproject.ospf.controller.LsaWrapper; | ||
| 21 | + | ||
| 22 | +import java.util.Map; | ||
| 23 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 24 | + | ||
| 25 | +/** | ||
| 26 | + * Represents a bin, where an LSA is stored for Aging. | ||
| 27 | + * A bin is identified by a bin number and can have one or more LSAs | ||
| 28 | + * store in a particular bin location. | ||
| 29 | + */ | ||
| 30 | +public class LsaBinImpl implements LsaBin { | ||
| 31 | + | ||
| 32 | + private int binNumber; | ||
| 33 | + private Map<String, LsaWrapper> listOfLsa = new ConcurrentHashMap<>(); | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * Creates an instance of LSA bin. | ||
| 37 | + * | ||
| 38 | + * @param binNumber unique number of this bin | ||
| 39 | + */ | ||
| 40 | + public LsaBinImpl(int binNumber) { | ||
| 41 | + this.binNumber = binNumber; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Adds the LSA to this bin with the given key. | ||
| 46 | + * | ||
| 47 | + * @param lsaKey key of the LSA | ||
| 48 | + * @param lsaWrapper wrapper instance to store | ||
| 49 | + */ | ||
| 50 | + public void addOspfLsa(String lsaKey, LsaWrapper lsaWrapper) { | ||
| 51 | + if (!listOfLsa.containsKey(lsaKey)) { | ||
| 52 | + listOfLsa.put(lsaKey, lsaWrapper); | ||
| 53 | + lsaWrapper.setBinNumber(this.binNumber); | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * Gets the LSA from the bin. | ||
| 59 | + * | ||
| 60 | + * @param lsaKey key to search the LSA | ||
| 61 | + * @return LSA Wrapper instance | ||
| 62 | + */ | ||
| 63 | + public LsaWrapper ospfLsa(String lsaKey) { | ||
| 64 | + | ||
| 65 | + return listOfLsa.get(lsaKey); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * Removes LSA from the bin. | ||
| 70 | + * | ||
| 71 | + * @param lsaKey key to search LSA | ||
| 72 | + * @param lsaWrapper wrapper object to remove | ||
| 73 | + */ | ||
| 74 | + public void removeOspfLsa(String lsaKey, LsaWrapper lsaWrapper) { | ||
| 75 | + if (listOfLsa.containsKey(lsaKey)) { | ||
| 76 | + listOfLsa.remove(lsaKey); | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * Gets the list of LSAs in this bin as key value pair. | ||
| 82 | + * | ||
| 83 | + * @return list of LSAs in this bin as key value pair | ||
| 84 | + */ | ||
| 85 | + public Map<String, LsaWrapper> listOfLsa() { | ||
| 86 | + return listOfLsa; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * Gets the bin number. | ||
| 91 | + * | ||
| 92 | + * @return the bin number | ||
| 93 | + */ | ||
| 94 | + public int binNumber() { | ||
| 95 | + return binNumber; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + @Override | ||
| 99 | + public String toString() { | ||
| 100 | + return MoreObjects.toStringHelper(getClass()) | ||
| 101 | + .omitNullValues() | ||
| 102 | + .add("binNumber", binNumber) | ||
| 103 | + .add("listOfLsa", listOfLsa) | ||
| 104 | + .toString(); | ||
| 105 | + } | ||
| 106 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsaWrapperImpl.java
0 → 100755
This diff is collapsed. Click to expand it.
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * Implementation of the OSPF Link state database and Ageing. | ||
| 19 | + */ | ||
| 20 | +package org.onosproject.ospf.controller.lsdb; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfEligibleRouter.java
0 → 100755
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.ospf.controller.util; | ||
| 17 | + | ||
| 18 | +import org.onlab.packet.Ip4Address; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * Represents a router who is eligible for DR election. | ||
| 22 | + */ | ||
| 23 | +public class OspfEligibleRouter { | ||
| 24 | + | ||
| 25 | + private Ip4Address ipAddress; | ||
| 26 | + private Ip4Address routerId; | ||
| 27 | + private int routerPriority; | ||
| 28 | + private boolean isDr; | ||
| 29 | + private boolean isBdr; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Creates an instance. | ||
| 33 | + * Initialize IP address of eligible router. | ||
| 34 | + */ | ||
| 35 | + public OspfEligibleRouter() { | ||
| 36 | + ipAddress = Ip4Address.valueOf("0.0.0.0"); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * Gets the value of IP address. | ||
| 41 | + * | ||
| 42 | + * @return IP address | ||
| 43 | + */ | ||
| 44 | + public Ip4Address getIpAddress() { | ||
| 45 | + return ipAddress; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * Sets the value of IP address. | ||
| 50 | + * | ||
| 51 | + * @param ipAddress IP address | ||
| 52 | + */ | ||
| 53 | + public void setIpAddress(Ip4Address ipAddress) { | ||
| 54 | + this.ipAddress = ipAddress; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * Gets the value of router id. | ||
| 59 | + * | ||
| 60 | + * @return router id. | ||
| 61 | + */ | ||
| 62 | + public Ip4Address getRouterId() { | ||
| 63 | + return routerId; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * Sets the value of router id. | ||
| 68 | + * | ||
| 69 | + * @param routerId router id | ||
| 70 | + */ | ||
| 71 | + public void setRouterId(Ip4Address routerId) { | ||
| 72 | + this.routerId = routerId; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * Gets the value of router priority. | ||
| 77 | + * | ||
| 78 | + * @return router priority. | ||
| 79 | + */ | ||
| 80 | + public int getRouterPriority() { | ||
| 81 | + return routerPriority; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * Sets the value of router priority. | ||
| 86 | + * | ||
| 87 | + * @param routerPriority router priority | ||
| 88 | + */ | ||
| 89 | + public void setRouterPriority(int routerPriority) { | ||
| 90 | + this.routerPriority = routerPriority; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * Gets whether the router is DR. | ||
| 95 | + * | ||
| 96 | + * @return boolean true if router is DR else return false. | ||
| 97 | + */ | ||
| 98 | + public boolean isDr() { | ||
| 99 | + return isDr; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * Sets the router is DR or not. | ||
| 104 | + * | ||
| 105 | + * @param isDr router is DR or not | ||
| 106 | + */ | ||
| 107 | + public void setIsDr(boolean isDr) { | ||
| 108 | + this.isDr = isDr; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * Gets whether the router is BDR or not. | ||
| 113 | + * | ||
| 114 | + * @return boolean true if router is Bdr else return false. | ||
| 115 | + */ | ||
| 116 | + public boolean isBdr() { | ||
| 117 | + return isBdr; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + /** | ||
| 121 | + * Sets the router is BDR or not. | ||
| 122 | + * | ||
| 123 | + * @param isBdr the router is BDR or not | ||
| 124 | + */ | ||
| 125 | + public void setIsBdr(boolean isBdr) { | ||
| 126 | + this.isBdr = isBdr; | ||
| 127 | + } | ||
| 128 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfInterfaceType.java
0 → 100755
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.ospf.controller.util; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Enum represents OSPF interface types. | ||
| 20 | + */ | ||
| 21 | +public enum OspfInterfaceType { | ||
| 22 | + | ||
| 23 | + POINT_TO_POINT(1), | ||
| 24 | + BROADCAST(2), | ||
| 25 | + VIRTUAL(3); | ||
| 26 | + | ||
| 27 | + private int value; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Creates an instance. | ||
| 31 | + * | ||
| 32 | + * @param value value represents interface type | ||
| 33 | + */ | ||
| 34 | + OspfInterfaceType(int value) { | ||
| 35 | + this.value = value; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * Gets value represents interface type. | ||
| 40 | + * | ||
| 41 | + * @return value represents interface type | ||
| 42 | + */ | ||
| 43 | + public int value() { | ||
| 44 | + return value; | ||
| 45 | + } | ||
| 46 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.ospf.controller.util; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Enum represents OSPF link type. | ||
| 20 | + */ | ||
| 21 | +public enum OspfLinkType { | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * Indicates a point-to-point connection to another router. | ||
| 25 | + */ | ||
| 26 | + POINT_TO_POINT, | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * Indicates a connection to a transit network. | ||
| 30 | + */ | ||
| 31 | + TO_TRANSIT_NET, | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * Indicates a connection to a stub network. | ||
| 35 | + */ | ||
| 36 | + TO_STUB_NET, | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * Indicates a Virtual link to another area border router. | ||
| 40 | + */ | ||
| 41 | + VIRTUAL_LINK; | ||
| 42 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +/* | ||
| 2 | + * Copyright 2016 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * Implementation of the OSPF utilities. | ||
| 19 | + */ | ||
| 20 | +package org.onosproject.ospf.controller.util; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment