Skip to content
Snippets Groups Projects
Commit e2db03f0 authored by Pablo Armingol's avatar Pablo Armingol
Browse files

nodes and .jar fixed

parent a9cb70a4
No related branches found
No related tags found
2 merge requests!235Release TeraFlowSDN 3.0,!151Resolve "(TID) New BGP-LS Speaker component"
Showing
with 492 additions and 197 deletions
......@@ -16,56 +16,22 @@
# Maven install stage
#
# ----------------------------------------------
FROM alpine/git:latest AS repo
# FROM alpine/git:latest AS repo
WORKDIR /usr/src/app
RUN git clone https://github.com/telefonicaid/netphony-network-protocols.git .
# WORKDIR /usr/src/app
# RUN git clone https://github.com/telefonicaid/netphony-network-protocols.git .
FROM maven:3.8.8-eclipse-temurin-17 AS build
# RUN mkdir -p /var/teraflow/java_speaker/
# WORKDIR /var/teraflow/java_speaker
# RUN mkdir -p protocols/
# COPY ../netphony-network-protocols/src protocols/src
# COPY ../netphony-network-protocols/pom.xml protocols/pom.xml
# RUN mvn dependency:resolve
# RUN mvn clean verify
# WORKDIR /var/teraflow/java_speaker/protocols
# RUN mvn clean install
COPY --from=repo /usr/src/app/* /protocols/
WORKDIR /protocols/
# RUN mvn package -X
# RUN mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file \
# -Dfile=/protocols/target/network-protocols-1.1-SNAPSHOT.jar \
# -DgroupId=es.tid.netphony \
# -DartifactId=network-protocols \
# -Dversion=1.1-SNAPSHOT \
# -Dpackaging=jar \
# -DlocalRepositoryPath=/
RUN mvn clean install -X
WORKDIR /
RUN mkdir -p /var/teraflow/bgpls
WORKDIR /var/teraflow/bgpls
# COPY . /var/teraflow/bgpls/
COPY src/bgpls_speaker/service/java/netphony-topology/ /var/teraflow/bgpls/service/java/netphony-topology/
COPY src/bgpls_speaker/service/java/netphony-topology/pom.xml pom.xml
WORKDIR /var/teraflow/bgpls/service/java/netphony-topology/
# RUN mvn clean compile -DskipTests -Dmaven.repo.local=$HOME/.m2/es/tid/netphony/network-protocols
# RUN mvn package -P bgp-ls-speaker assembly:single -DskipTests
# ENTRYPOINT [ "ls","-R" ]
COPY src/bgpls_speaker/service/java/netphony-topology/ netphony-topology/
COPY src/bgpls_speaker/service/java/netphony-topology/pom.xml netphony-topology/pom.xml
WORKDIR /netphony-topology/
RUN mvn clean compile -DskipTests -X
RUN mvn package assembly:single -P bgp-ls-speaker -DskipTests
WORKDIR /netphony-topology/target/
# ENTRYPOINT [ "ls" ,"-a"]
# -------------------------------------------
# jar created in /netphony-topology/target/bgp-ls-speaker-jar-with-dependencies.jar
......@@ -131,7 +97,7 @@ RUN python3 -m pip install -r requirements.txt
WORKDIR /var/teraflow/bgpls_speaker
RUN mkdir -p /java
COPY src/bgpls_speaker/service/java/* /java/
COPY --from=build /var/teraflow/bgpls/service/java/netphony-topology/target/bgp-ls-speaker-jar-with-dependencies.jar /var/teraflow/bgpls_speaker/bgp_ls.jar
COPY --from=build /netphony-topology/target/bgp-ls-speaker-jar-with-dependencies.jar /var/teraflow/bgpls_speaker/service/java/bgp_ls.jar
# Add component files into working directory
WORKDIR /var/teraflow
......
This diff is collapsed.
......@@ -61,8 +61,8 @@ class BgplsServiceServicerImpl(BgplsServiceServicer):
links = self.discoveredDB.GetLinksFromDiscoveredDB()
links_info=[]
for link in links:
local=NodeDescriptors(bgplsID=link.local.bgpls_id,nodeName=link.local.node_name)
remote=NodeDescriptors(bgplsID=link.remote.bgpls_id,nodeName=link.remote.node_name)
local=NodeDescriptors(igp_id=link.local_id,nodeName=link.local_id)
remote=NodeDescriptors(igp_id=link.remote_id,nodeName=link.remote_id)
links_info.append(DiscoveredLink(local=local,remote=remote,learntFrom=link.learnt_from))
return DiscoveredLinkList(discoveredlinks=links_info)
......
<!-- Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
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. -->
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
......@@ -27,6 +13,19 @@ limitations under the License. -->
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
<!-- Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -->
<!-- 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. -->
</license>
</licenses>
<dependencies>
......@@ -51,7 +50,7 @@ limitations under the License. -->
<dependency>
<groupId>es.tid.netphony</groupId>
<artifactId>network-protocols</artifactId>
<version>1.1-SNAPSHOT</version>
<version>1.4.1</version>
<!-- Next local repo only on docker container -->
<!-- <scope>system</scope>
<systemPath>/protocols/target/network-protocols-1.1-SNAPSHOT.jar</systemPath> -->
......
......@@ -137,6 +137,7 @@ public class grpcClient {
setAsPathSegment(Integer.toString(update.getAsPathSegment())).
addAllLink(l).build();
}else if(nodes.size()>0&& l.size()==0) {
logger.debug("ADDING NODE");
request=updateRequest.newBuilder().
setNextHop(update.getNextHop().toString()).
setAddressFamilyID(Integer.toString(update.getAFI())).
......@@ -145,6 +146,7 @@ public class grpcClient {
}else {
//Error if node name is null
// TODO: handle seng grpc error?
logger.debug("ADDING NODE AND LINK");
request=updateRequest.newBuilder().
setNextHop("-"+update.getNextHop().toString()).
setAddressFamilyID(Integer.toString(update.getAFI())).
......
// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
// Licensed under the Apache License, Version 2.0 (the "License");
......@@ -140,10 +141,10 @@ public class LinkNLRIMsg {
IGP_type = linkNLRI.getRemoteNodeDescriptorsTLV().getIGPRouterID().getIGP_router_id_type();
switch (IGP_type) {
case 1:
remoteIGPID = Integer.toString(linkNLRI.getRemoteNodeDescriptorsTLV().getIGPRouterID().getISIS_ISO_NODE_ID());
remoteBgplsID = Integer.toString(linkNLRI.getRemoteNodeDescriptorsTLV().getIGPRouterID().getISIS_ISO_NODE_ID());
break;
case 2:
remoteIGPID = Integer.toString(linkNLRI.getRemoteNodeDescriptorsTLV().getIGPRouterID().getISIS_ISO_NODE_ID());
remoteBgplsID = Integer.toString(linkNLRI.getRemoteNodeDescriptorsTLV().getIGPRouterID().getISIS_ISO_NODE_ID());
case 3:
remoteIGPID = linkNLRI.getRemoteNodeDescriptorsTLV().getIGPRouterID().getIpv4AddressOSPF().toString();
break;
......@@ -204,13 +205,6 @@ public class LinkNLRIMsg {
}
public String localIGPID() {
return localIGPID;
}
public String remoteIGPID() {
return remoteIGPID;
}
public String getLearntFrom() {
return learntFrom;
}
......
......@@ -29,11 +29,17 @@ public class UpdateMsg {
private LinkNLRIMsg link;
private PathAttributeMsg path;
private List <LinkNLRIMsg> linkList = new ArrayList<>();
private List <NodeNLRIMsg> nodeList = new ArrayList<>();
public List <LinkNLRIMsg> getLinkList(){
return this.linkList;
}
public List <NodeNLRIMsg> getNodeList(){
return this.nodeList;
}
public void addNode(NodeNLRIMsg node) {
this.nodeList.add(node);
}
public int getAFI() {
return AFI;
}
......@@ -70,6 +76,9 @@ public class UpdateMsg {
public boolean linkCheck(){
return linkList.size()>0;
}
public boolean nodeCheck(){
return nodeList.size()>0;
}
public void setLink(LinkNLRIMsg link) {
this.link = link;
}
......
......@@ -329,7 +329,7 @@ public class UpdateProccesorThread extends Thread {
NodeNLRIMsg NnlriMsg = new NodeNLRIMsg((NodeNLRI)linkstateNLRI,learntFrom,currentName);
log.info("Node info: " + NnlriMsg.toString());
updateMsgList.addNodeToJson(NnlriMsg,currentName);
update.setNode(NnlriMsg);//set for grpc msg
update.addNode(NnlriMsg);//set for grpc msg
}
currentName=null;
continue;
......
<!-- Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
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. -->
<config>
<!-- TCP port where the BGP is listening for incoming bgp4 connections. Optional Parameter. Default value: 179 (BGP Port) -->
<BGP4Port>12179</BGP4Port>
<BGPIdentifier>1.1.1.1</BGPIdentifier>
<!-- TCP port to connect to manage the BGP connection. Default value: 1112 -->
<BGP4ManagementPort>1112</BGP4ManagementPort>
<!-- Peers to which this Peer is going to establish connection -->
<configPeer>
<peer>10.95.86.214</peer>
<export>false</export>
<import>true</import>
<peerPort>179</peerPort>
</configPeer>
<!-- Ficheros log (servidor, protocolo PCEP y OSPF). Campos opcionales-->
<BGP4LogFile>BGP4Parser2.log</BGP4LogFile><!-- Default value: BGP4Parser.log -->
<BGP4LogFileClient>BGP4Client2.log</BGP4LogFileClient><!-- Default value: BGP4Client.log-->
<BGP4LogFileServer>BGP4Server2.log</BGP4LogFileServer><!-- Default value: BGP4Server.log-->
<!-- If the tcp no delay option is used or not. Optional Parameter. Default value: false. -->
<nodelay>true</nodelay>
<!-- Waiting Time to re-connect to clients. Default value: 6000 ms. -->
<delay>40000</delay>
<setTraces>true</setTraces>
<!-- OPEN Parameters -->
<!-- RFC 4271. This 2-octet unsigned integer indicates the number of seconds the sender proposes for the value of the Hold Timer.
Upon receipt of an OPEN message, a BGP speaker MUST calculate the value of the Hold Timer by using the smaller of its configured
Hold Time and the Hold Time received in the OPEN message. The Hold Time MUST be either zero or at least three seconds. An
implementation MAY reject connections on the basis of the Hold Time. The calculated value indicates the maximum number of
seconds that may elapse between the receipt of successive KEEPALIVE and/or UPDATE messages from the sender. -->
<holdTime>180</holdTime><!-- Optional Parameter. Default value: 3. -->
<!-- RFC 4271. This 1-octet unsigned integer indicates the protocol version number of the message. The current BGP version number is 4. -->
<version>4</version><!-- Optional Parameter. Default value: 4. -->
<!-- RFC 4271. This 2-octet unsigned integer indicates the Autonomous System number of the sender.-->
<myAutonomousSystem>65006</myAutonomousSystem>
<!-- RFC 4271. This 4-octet unsigned integer indicates the BGP Identifier of the sender. A given BGP speaker sets the value of its BGP
Identifier to an IP address that is assigned to that BGP speaker. The value of the BGP Identifier is determined upon
startup and is the same for every local interface and BGP peer. -->
<!--<BGPIdentifier>192.168.1.200</BGPIdentifier> -->
<!-- If the peer is in charge of sending its topology (only the interdomain Links) to the other BGP peer it is connected to. Default: false -->
<sendTopology>false</sendTopology>
<!-- If the peer is in charge of sending its whole topology to the other BGP peer it is connected to. Default: false -->
<sendIntradomainLinks>true</sendIntradomainLinks>
<!-- Optional Parameter. How to learn the topology. Possibilities: fromXML, fromBGP. Default: fromBGP -->
<learnTopology>fromBGP</learnTopology>
<!-- Topology network to read. It is mandatory if and only if learnTopology parameter is fromXML. -->
<!--<topologyFile>src/test/resources/network1.xml</topologyFile>-->
<!-- Optional Parameter. Instance Identifier for node and link NLRI. See rfc 6549. Default value: 0-->
<!--<instanceID>0</instanceID>-->
<!-- Optional Parameter. Default value: localhost -->
<localBGPAddress>0.0.0.0</localBGPAddress>
</config>
\ No newline at end of file
File deleted
{
"devices":[
{"name":"HL2-1-1","IP-Addr":"10.95.90.76",
"interfaces":{
"99.1.2.1":"GigabitEthernet0/0/0/0",
"99.1.3.1":"GigabitEthernet0/0/0/1",
"99.1.11.1":"GigabitEthernet0/0/0/2"},
"links":{
"GigabitEthernet0/0/0/0":"HL2-2-1",
"GigabitEthernet0/0/0/1":"HL2-3-1",
"GigabitEthernet0/0/0/2":"HL2-1-2"
}
},
{"name":"HL2-3-1","IP-Addr":"10.95.90.78",
"interfaces":{
"99.3.4.3":"GigabitEthernet0/0/0/0",
"99.1.3.3":"GigabitEthernet0/0/0/1",
"99.3.33.3":"GigabitEthernet0/0/0/2",
"99.3.52.2":"GigabitEthernet0/0/0/3"},
"links":{
"GigabitEthernet0/0/0/0":"HL2-4-1",
"GigabitEthernet0/0/0/1":"HL2-1-1",
"GigabitEthernet0/0/0/2":"HL2-3-2",
"GigabitEthernet0/0/0/3":"HL3-1-1"
}},
{"name":"HL2-2-2","IP-Addr":"10.95.90.81",
"interfaces":{
"99.1.12.2":"ge-0/0/0",
"99.2.24.2":"ge-0/0/1",
"99.2.22.22":"ge-0/0/2",
"99.2.99.2":"ge-0/0/9"},
"links":{
"ge-0/0/0":"HL2-1-2",
"ge-0/0/1":"HL2-4-2",
"ge-0/0/2":"HL2-2-1",
"ge-0/0/9":"HL2-4-2_OSPF"
}},
{"name":"HL2-2-1","IP-Addr":"10.95.90.77",
"interfaces":{
"99.1.2.2":"Gi0/0/0/0",
"99.2.4.2":"Gi0/0/0/1",
"99.2.22.2":"Gi0/0/0/2"},
"links":{
"Gi0/0/0/0":"HL2-1-1",
"Gi0/0/0/1":"HL2-4-1",
"Gi0/0/0/2":"HL2-2-2"
}}
]
}
\ No newline at end of file
......@@ -51,6 +51,8 @@ class DiscoveredDBManager:
# is a link
# Compare and update
self.discoveredDB.append(update_request)
LOGGER.debug("(AddToDB) Actual DB: ")
LOGGER.debug("%s", [up.toString() for up in self.discoveredDB])
return True
def GetDiscoveredDB(self):
......@@ -127,16 +129,16 @@ class DiscoveredDBManager:
"""
for update in self.discoveredDB:
for link in update.links:
if(self.GetNodeNameFromLinkId(link.local.bgpls_id) is not None):
LOGGER.info("(UpdateNodeNameInLink) local %s: %s",link.local.bgpls_id, self.GetNodeNameFromLinkId(link.local.bgpls_id))
link.local.node_name=self.GetNodeNameFromLinkId(link.local.bgpls_id)
if(self.GetNodeNameFromLinkId(link.localID) is not None):
LOGGER.info("(UpdateNodeNameInLink) local %s: %s",link.localID, self.GetNodeNameFromLinkId(link.localID))
link.local.node_name=self.GetNodeNameFromLinkId(link.localID)
else:
link.local.node_name=link.local.bgpls_id
if(self.GetNodeNameFromLinkId(link.remote.bgpls_id) is not None):
LOGGER.info("(UpdateNodeNameInLink) remote %s: %s",link.remote.bgpls_id, self.GetNodeNameFromLinkId(link.remote.bgpls_id))
link.remote.node_name=self.GetNodeNameFromLinkId(link.remote.bgpls_id)
link.local.node_name=link.localID
if(self.GetNodeNameFromLinkId(link.remoteID) is not None):
LOGGER.info("(UpdateNodeNameInLink) remote %s: %s",link.remoteID, self.GetNodeNameFromLinkId(link.remoteID))
link.remote.node_name=self.GetNodeNameFromLinkId(link.remoteID)
else:
link.remote.node_name=link.remote.bgpls_id
link.remote.node_name=link.remoteID
return True
def RemoveLinkFromDB(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment