Skip to content

Commit

Permalink
Merge pull request #500 from esnet/OS-309-update-oscars-backend-to-su…
Browse files Browse the repository at this point in the history
…pport-untagged-ports

feat: [OS-309] Add support for 'untagged' ports.
  • Loading branch information
zrecore authored Jan 30, 2025
2 parents 296c8aa + f771a80 commit 572b642
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# OSCARS Release Notes

### 1.2.19
> Jan 2025
- Support for 'untagged' (`EthernetEncapsulation.NULL`) and QINQ (`EthernetEncapsulation.QINQ`) ethernet encapsulation labeling. Application properties `features.untagged-ports` and `features.qinq-ports` flags added.

### 1.2.18
> Jan 2025
- NSI response size hotfix
Expand Down
19 changes: 19 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ This file contains instructions for updating an existing installation of OSCARS

Instructions include config file changes, database schema changes, etc.

## v1.2.18 to 1.2.19
Assert this exists in `application.properties`:
```
# Support for untagged ports in topo-common version 0.0.31 or higher.
# See https://esnet.atlassian.net/browse/OCD-613
# Enabled = true. Disabled = false.
# Default: false.
# Process untagged 'NULL' ethernet encapsulation ports from topology discovery:
# Enabled: Ingest Port objects and INCLUDE the ethernetEncapsulation.NULL enum type.
# Disabled: Ingest Port objects and IGNORE the ethernetEncapsulation.NULL enum type.
features.untagged-ports=false
# Process QINQ ethernet encapsulation ports from topology discovery:
# Enabled: Ingest Port objects and INCLUDE the ethernetEncapsulation.QINQ enum type.
# Disabled: Ingest Port objects and IGNORE the ethernetEncapsulation.QINQ enum type.
features.qinq-ports=false
```

## v1.1.3 to 1.1.4
### backend
Add these to `application.properties`:
Expand Down
15 changes: 15 additions & 0 deletions backend/config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,18 @@ esdb.enabled=true
# format this period like
# https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html#parse(java.lang.CharSequence)
esdb.vlan-sync-period=PT5M

# Support for untagged ports in topo-common version 0.0.31 or higher.
# See https://esnet.atlassian.net/browse/OCD-613
# Enabled = true. Disabled = false.
# Default: false.

# Process untagged 'NULL' ethernet encapsulation ports from topology discovery:
# Enabled: Ingest Port objects and INCLUDE the ethernetEncapsulation.NULL enum type.
# Disabled: Ingest Port objects and IGNORE the ethernetEncapsulation.NULL enum type.
features.untagged-ports=false

# Process QINQ ethernet encapsulation ports from topology discovery:
# Enabled: Ingest Port objects and INCLUDE the ethernetEncapsulation.QINQ enum type.
# Disabled: Ingest Port objects and IGNORE the ethernetEncapsulation.QINQ enum type.
features.qinq-ports=false
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package net.es.oscars.app.props;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@EnableConfigurationProperties(FeaturesProperties.class)
@ConfigurationProperties(prefix = "features")
@NoArgsConstructor
public class FeaturesProperties {
@NonNull
private Boolean untaggedPorts = false;
@NonNull
private Boolean qinqPorts = false;
}
21 changes: 20 additions & 1 deletion backend/src/main/java/net/es/oscars/topo/pop/TopoPopulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.extern.slf4j.Slf4j;
import net.es.oscars.app.props.StartupProperties;
import net.es.oscars.app.props.TopoProperties;
import net.es.oscars.app.props.FeaturesProperties;
import net.es.oscars.dto.topo.DeviceModel;
import net.es.oscars.topo.beans.*;
import net.es.oscars.topo.beans.IntRange;
Expand All @@ -32,6 +33,7 @@ public class TopoPopulator {

private final StartupProperties startupProperties;
private final TopoProperties topoProperties;
private final FeaturesProperties featuresProperties;
private final TopologyStore topologyStore;
private final ConsistencyService consistencySvc;
private final RestTemplate restTemplate;
Expand All @@ -42,7 +44,9 @@ public TopoPopulator(TopologyStore topologyStore,
ConsistencyService consistencySvc,
TopoProperties topoProperties,
StartupProperties startupProperties,
RestTemplateBuilder restTemplateBuilder, OpenTelemetry openTelemetry) {
RestTemplateBuilder restTemplateBuilder,
OpenTelemetry openTelemetry,
FeaturesProperties featuresProperties) {
this.topoProperties = topoProperties;
this.consistencySvc = consistencySvc;
this.topologyStore = topologyStore;
Expand All @@ -53,6 +57,7 @@ public TopoPopulator(TopologyStore topologyStore,
this.restTemplate.getInterceptors().add(telemetry.newInterceptor());

this.startupProperties = startupProperties;
this.featuresProperties = featuresProperties;
}


Expand Down Expand Up @@ -158,6 +163,20 @@ public Topology loadTopology() throws TopoException, ResourceAccessException, IO
.build();
devices.put(d.getUrn(), d);
for (OscarsOnePort discPort : discDevice.getPorts()) {
// If this is an 'untagged' port, and features.untagged-ports is disabled, skip.
// If this is a QINQ port, and features.qinq-ports is disabled, skip.
if (

( featuresProperties.getUntaggedPorts() == false
&& discPort.getEthernetEncapsulation() == EthernetEncapsulation.NULL )

|| ( featuresProperties.getQinqPorts() == false
&& discPort.getEthernetEncapsulation() == EthernetEncapsulation.QINQ )
) {
continue;
}


Set<Layer> portCaps = new HashSet<>();
for (OscarsOneCapability os1Cap : discPort.getCapabilities()) {
portCaps.add(Layer.valueOf(os1Cap.toString()));
Expand Down

0 comments on commit 572b642

Please sign in to comment.