forked from KNEMC/KLALB
Merge branch 'master' of https://git.code.cq.cn/KNEMC/KLALB
# Conflicts: # .classpath # src/org/kne/cloud/network/klalb/KLALBControllerConfigItem.java
This commit is contained in:
@@ -43,6 +43,10 @@ public class KLALBRoutingProtocol extends Thread{
|
||||
|
||||
private RouterInfo selfRouterInfo;
|
||||
private Map<IPv6Address, RouterInfo> netmap=new ConcurrentHashMap<>();
|
||||
|
||||
public Map<IPv6Address, RouterInfo> getNetmap() {
|
||||
return netmap;
|
||||
}
|
||||
|
||||
|
||||
private volatile Map<IPv6Address,Long>addresses;
|
||||
@@ -545,6 +549,7 @@ public class KLALBRoutingProtocol extends Thread{
|
||||
List<IPv6NetworkLink>links=router.getLinkTabel();
|
||||
Object[] nls=links.toArray();
|
||||
RouterInfo ri=new RouterInfo(System.currentTimeMillis(),router.getLocator(),router.getASN());
|
||||
ri.setDeviceName(router.getDeviceName());
|
||||
for(int i=0;i<nls.length;i++) {
|
||||
IPv6NetworkLink nl=(IPv6NetworkLink) nls[i];
|
||||
if((!nl.isLoopBack())&&nl.isUp()) {
|
||||
@@ -595,6 +600,19 @@ public class KLALBRoutingProtocol extends Thread{
|
||||
public Map<IPv6Address, Long> getAddresses() {
|
||||
return addresses;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询某地址广播的设备名称(未知返回null)
|
||||
*/
|
||||
public String getDeviceName(IPv6Address address) {
|
||||
RouterInfo ri=netmap.get(address);
|
||||
if(ri!=null) {
|
||||
String dn=ri.getDeviceName();
|
||||
if(dn!=null&&!dn.isEmpty())
|
||||
return dn;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public Map<IPv6Address, List<LinkDirection>> getPaths() {
|
||||
return paths;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user