forked from KNEMC/KLALB
区分了ENDXSID和ENDSID。移除了多余的路由表对象的isLoopback(),因为是否是环回是链路的属性,不是路由表的。
This commit is contained in:
@@ -260,18 +260,18 @@ public class IPv6TUNLoopbackNetworkLink extends AbstractIPv6NetworkLink
|
||||
List<RouteItem> rlist = new ArrayList<>();
|
||||
|
||||
for (IPv6AddressGroup grp : getAddressGroups()) {
|
||||
rlist.add(new RouteItem(new IPv6AddressGroup(grp.getAddress(), 128), grp.getAddress(), this, "Direct", 0, 1,
|
||||
null, "D", true));
|
||||
rlist.add(new RouteItem(new IPv6AddressGroup(grp.getAddress(), 128), grp.getAddress(), this, RouteItem.DIRECT, 0, 1,
|
||||
null, "D"));
|
||||
}
|
||||
|
||||
for (Iterator<Neighbor> iteratorx = getNeighborsInfo().iterator(); iteratorx.hasNext();) {
|
||||
Neighbor addresses = (Neighbor) iteratorx.next();
|
||||
RouteItem ri = new RouteItem(new IPv6AddressGroup(addresses.getAddress().getAddress(), 128),
|
||||
addresses.getAddress().getAddress(), this, "Direct", 0, 128, null, "D", false);
|
||||
addresses.getAddress().getAddress(), this, RouteItem.SRv6_ENDXSID, 0, 128, null, "D");
|
||||
rlist.add(ri);
|
||||
|
||||
RouteItem ris = new RouteItem(addresses.getLocator(), addresses.getLocator().getAddress(), this,
|
||||
"KLALB SRv6", 13, 128, null, "D", false);
|
||||
RouteItem.SRv6_ENDSID, 13, 128, null, "D");
|
||||
rlist.add(ris);
|
||||
|
||||
}
|
||||
|
||||
@@ -98,19 +98,18 @@ public class LoopbackIPv6NetworkLink extends AbstractIPv6NetworkLink implements
|
||||
List<RouteItem> rlist = new ArrayList<>();
|
||||
for(IPv6AddressGroup group:addressGroups) {
|
||||
rlist.add(new RouteItem(new IPv6AddressGroup(group.getAddress(), 128),
|
||||
group.getAddress(), this, "Direct", 0, 0, null, "D", true));
|
||||
group.getAddress(), this, RouteItem.DIRECT, 0, 0, null, "D"));
|
||||
}
|
||||
|
||||
for (Iterator<Neighbor> iteratorx = getNeighborsInfo().iterator(); iteratorx.hasNext();) {
|
||||
Neighbor addresses = (Neighbor) iteratorx.next();
|
||||
RouteItem ri = new RouteItem(new IPv6AddressGroup(addresses.getAddress().getAddress(), 128),
|
||||
addresses.getAddress().getAddress(), this, "Direct", 0, 128, null, "D",
|
||||
false);
|
||||
addresses.getAddress().getAddress(), this,RouteItem.SRv6_ENDXSID, 0, 128, null, "D");
|
||||
rlist.add(ri);
|
||||
|
||||
RouteItem ris = new RouteItem(addresses.getLocator(),
|
||||
addresses.getLocator().getAddress(), this, "KLALB SRv6", 13, 128,
|
||||
null, "D", false);
|
||||
addresses.getLocator().getAddress(), this, RouteItem.SRv6_ENDSID, 13, 128,
|
||||
null, "D");
|
||||
rlist.add(ris);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class RouteItem implements Comparable<RouteItem>,Cloneable{
|
||||
public static final String DIRECT="Direct";
|
||||
public static final String SRv6_ENDSID="SRv6 ENDSID";
|
||||
public static final String SRv6_ENDXSID="SRv6 ENDXSID";
|
||||
|
||||
private IPv6AddressGroup destination;
|
||||
private IPv6Address nexthop;
|
||||
private IPv6NetworkLink destlink;
|
||||
@@ -12,7 +16,6 @@ public class RouteItem implements Comparable<RouteItem>,Cloneable{
|
||||
private long cost;
|
||||
private String flag;
|
||||
private Supplier<Long> costSupplier;
|
||||
private boolean isLoopback;
|
||||
public String getFlag() {
|
||||
return flag;
|
||||
}
|
||||
@@ -34,7 +37,7 @@ public class RouteItem implements Comparable<RouteItem>,Cloneable{
|
||||
&& pre == other.pre && Objects.equals(proto, other.proto);
|
||||
}
|
||||
public RouteItem(IPv6AddressGroup destination, IPv6Address nexthop, IPv6NetworkLink destlink, String proto, int pre,
|
||||
long cost,String flag,boolean isLoopback) {
|
||||
long cost,String flag) {
|
||||
super();
|
||||
this.destination = destination;
|
||||
this.nexthop = nexthop;
|
||||
@@ -43,10 +46,9 @@ public class RouteItem implements Comparable<RouteItem>,Cloneable{
|
||||
this.pre = pre;
|
||||
this.cost = cost;
|
||||
this.flag=flag;
|
||||
this.isLoopback=isLoopback;
|
||||
}
|
||||
public RouteItem(IPv6AddressGroup destination, IPv6Address nexthop, IPv6NetworkLink destlink, String proto, int pre,
|
||||
long cost,Supplier<Long> costSupplier,String flag,boolean isLoopback) {
|
||||
long cost,Supplier<Long> costSupplier,String flag) {
|
||||
super();
|
||||
this.destination = destination;
|
||||
this.nexthop = nexthop;
|
||||
@@ -56,7 +58,6 @@ public class RouteItem implements Comparable<RouteItem>,Cloneable{
|
||||
this.cost = cost;
|
||||
this.costSupplier=costSupplier;
|
||||
this.flag=flag;
|
||||
this.isLoopback=isLoopback;
|
||||
}
|
||||
public IPv6AddressGroup getDestination() {
|
||||
return destination;
|
||||
@@ -73,9 +74,6 @@ public class RouteItem implements Comparable<RouteItem>,Cloneable{
|
||||
public int getPre() {
|
||||
return pre;
|
||||
}
|
||||
public boolean isLoopback() {
|
||||
return isLoopback;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return getDestination()+"\t"+getProto()+"\t"+getPre()+"\t"+getCost()+"\t"+getFlag()+"\t"+getNexthop()+"\t"+getDestlink().getName();
|
||||
|
||||
@@ -959,12 +959,12 @@ public class KLALBRemoteLink extends AbstractControlledIPv6NetworkLink implement
|
||||
for (Iterator<Neighbor> iteratorx = getNeighborsInfo().iterator(); iteratorx.hasNext(); ) {
|
||||
Neighbor addresses = (Neighbor) iteratorx.next();
|
||||
RouteItem ri = new RouteItem(new IPv6AddressGroup(addresses.getAddress().getAddress(), 128),
|
||||
addresses.getAddress().getAddress(), this, "Direct", 0, 128, CostSupplierFactory.expectedDelaySupplier((DelayMonitorData) addresses.getMonitor(), status, algorithm::getRTO), "D", false);
|
||||
addresses.getAddress().getAddress(), this, RouteItem.SRv6_ENDXSID, 0, 128, CostSupplierFactory.expectedDelaySupplier((DelayMonitorData) addresses.getMonitor(), status, algorithm::getRTO), "D");
|
||||
rlist.add(ri);
|
||||
|
||||
if (addresses.getLocator() != null) {
|
||||
RouteItem ris = new RouteItem(addresses.getLocator(), addresses.getLocator().getAddress(), this,
|
||||
"KLALB SRv6", 13, 128, CostSupplierFactory.expectedDelaySupplier((DelayMonitorData) addresses.getMonitor(), status, algorithm::getRTO), "D", false);
|
||||
RouteItem.SRv6_ENDSID, 13, 128, CostSupplierFactory.expectedDelaySupplier((DelayMonitorData) addresses.getMonitor(), status, algorithm::getRTO), "D");
|
||||
rlist.add(ris);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user