Skip to content

Commit

Permalink
fix: [OS-285] Complete fixes for operational state (#466)
Browse files Browse the repository at this point in the history
* support ocd-stack's healthcheck on new centos image

* further operational state fixes

* fix npe

* further fixes to opstatus

* further FURTHER fixes to opstatus

* further fix to sdp state

* fix sdpId / vcId parsing

* fix raw display

* remove debug dumps

---------

Co-authored-by: haniotak <[email protected]>
  • Loading branch information
haniotak and haniotak authored Mar 25, 2024
1 parent bd27ef5 commit 7734fde
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 110 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# OSCARS Release Notes
### 1.2.3
- OS-285: fix operational state bugs

### 1.2.2
> Mar 2024
- OS-227: add an ip interface frontend
Expand Down
2 changes: 1 addition & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<groupId>net.es.oscars</groupId>
<artifactId>backend</artifactId>
<name>backend</name>
<version>1.2.2</version>
<version>1.2.3</version>

<description>OSCARS backend</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ public ArrayList<LiveStatusSdpResult> refreshSdp(String device, int serviceId) {
ArrayList<String> sdpsList = this.getDataLines(reply);

// extract SDP data - simple line format parsing
// incoming format:
// 7141:7087 Spok 134.55.200.173 Up Up 524100 524267
// sdpId : vcId

for (int i = 0; i < sdpsList.size(); i++) {
result = new LiveStatusSdpResult();
result.setDevice(device);
Expand All @@ -119,14 +123,13 @@ public ArrayList<LiveStatusSdpResult> refreshSdp(String device, int serviceId) {
break;
}

int vcId = 0;
int sdpId = 0;
int vcId = 0;
try {
vcId = Integer.parseInt(sdpIdAndInfo[0]);
sdpId = Integer.parseInt(sdpInfo[0]);
sdpId = Integer.parseInt(sdpIdAndInfo[0]);
vcId = Integer.parseInt(sdpInfo[0]);
} catch (NumberFormatException error) {
log.error("Couldn't parse VC/SDP ID");
error.printStackTrace();
log.error("Couldn't parse VC/SDP ID from "+line+" : "+error.getMessage());
}
result.setVcId(vcId);
result.setSdpId(sdpId);
Expand Down Expand Up @@ -396,10 +399,19 @@ public ArrayList<String> getDataLines(String input) {
if (input == null) return null;
ArrayList<String> data = new ArrayList<>();
String[] lines = input.split("\r\n");
Pattern regex = Pattern.compile("^[0-9]{1}");

// starts with a number, i.e. for something like
// 1/1/c13/1:2012 7072 7001 none 7001 none Up Up
Pattern startsWithNumber = Pattern.compile("^[0-9]{1}");

// some SAP lines look different and we want those too
// lag-50:3603 7072 7005 none 7005 none Up Up
Pattern startsWithLag = Pattern.compile("^lag");

for (String line : lines) {
Matcher m = regex.matcher(line);
if (m.find()) {
Matcher numberMatch = startsWithNumber.matcher(line);
Matcher lagMatch = startsWithLag.matcher(line);
if (numberMatch.find() || lagMatch.find()) {
data.add(line);
}
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/java/net/es/oscars/task/EsdbVlanSync.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public EsdbVlanSync(Startup startup, ConnectionRepository cr, ESDBProxy esdbProx
this.topologyStore = topologyStore;
}

@Scheduled(initialDelay = 10000,fixedDelayString ="${esdb.vlan-sync-period}" )
@Scheduled(initialDelay = 120000, fixedDelayString ="${esdb.vlan-sync-period}" )
public void processingLoop() {
if (!esdbProperties.isEnabled()) {
return;
Expand Down
Loading

0 comments on commit 7734fde

Please sign in to comment.