Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
> Feb 2026
- ESE-361 fix last modified date for L2VPN
- OS-672 error when modifying VLAN ids
- OS-670 add hard / soft cap parameter to NSI

### 1.2.36
> Dec 2025
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ public class NsiMappingService {
private final ResvService resvService;
private final PceService pceService;

@Value("${nsi.strict-policing:true}")
private boolean strictPolicing;

@Value("${nml.topo-id}")
private String topoId;
Expand Down Expand Up @@ -272,7 +270,7 @@ public List<Pipe> pipesFor(Interval interval, Integer mbps,

}

public Pair<List<Fixture>, List<Junction>> simpleComponents(Connection c, int mbps) {
public Pair<List<Fixture>, List<Junction>> simpleComponents(Connection c, int mbps, boolean strictPolicing) {
List<Junction> junctions = new ArrayList<>();
List<Fixture> fixtures = new ArrayList<>();
for (VlanFixture vf: c.getReserved().getCmp().getFixtures()) {
Expand All @@ -294,7 +292,7 @@ public Pair<List<Fixture>, List<Junction>> simpleComponents(Connection c, int mb
return Pair.of(fixtures, junctions);
}

public Pair<List<Fixture>, List<Junction>> fixturesAndJunctionsFor(P2PServiceBaseType p2p, Interval interval, String oscarsConnectionId)
public Pair<List<Fixture>, List<Junction>> fixturesAndJunctionsFor(P2PServiceBaseType p2p, Interval interval, String oscarsConnectionId, boolean strictPolicing)
throws NsiInternalException, NsiValidationException {
String src = p2p.getSourceSTP();
String dst = p2p.getDestSTP();
Expand Down
19 changes: 17 additions & 2 deletions backend/src/main/java/net/es/oscars/nsi/svc/NsiService.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public class NsiService {
@Value("${nsi.provider-nsa}")
private String providerNsa;

@Value("${nsi.strict-policing:true}")
private boolean strictPolicingDefault;


final public static String SERVICE_TYPE = "http://services.ogf.org/nsi/2013/12/descriptions/EVTS.A-GOLE";
final public static String NSI_TYPES = "http://schemas.ogf.org/nsi/2013/12/framework/types";

Expand Down Expand Up @@ -1046,10 +1050,21 @@ public NsiReserveResult hold(ReserveType incomingRT, NsiMapping mapping) throws
ConnectionMode connectionMode = ConnectionMode.NEW;
Set<String> projectId = new HashSet<>();

boolean strictPolicing = strictPolicingDefault;

for (TypeValueType tvt : p2ps.getParameter()) {
if (tvt.getType().equals("projectId") && tvt.getValue() != null && !tvt.getValue().isEmpty()) {
projectId.add(tvt.getValue());
}

if (tvt.getType().equals("policing") && tvt.getValue() != null && !tvt.getValue().isEmpty()) {
if (tvt.getValue().strip().equalsIgnoreCase("strict")) {
strictPolicing = true;
}
if (tvt.getValue().strip().equalsIgnoreCase("soft")) {
strictPolicing = false;
}
}
}

if (optC.isPresent()) {
Expand All @@ -1068,7 +1083,7 @@ public NsiReserveResult hold(ReserveType incomingRT, NsiMapping mapping) throws
.build();
}
// recreate f, j, p based on reserved w modified mbps if applicable
Pair<List<Fixture>, List<Junction>> fjp = nsiMappingService.simpleComponents(c, mbps);
Pair<List<Fixture>, List<Junction>> fjp = nsiMappingService.simpleComponents(c, mbps, strictPolicing);
fixtures = fjp.getLeft();
junctions = fjp.getRight();
pipes = nsiMappingService.pipesFor(interval, mbps, junctions, include);
Expand All @@ -1087,7 +1102,7 @@ public NsiReserveResult hold(ReserveType incomingRT, NsiMapping mapping) throws
begin = interval.getBeginning().getEpochSecond();
end = interval.getEnding().getEpochSecond();

Pair<List<Fixture>, List<Junction>> fjs = nsiMappingService.fixturesAndJunctionsFor(p2ps, interval, oscarsConnectionId);
Pair<List<Fixture>, List<Junction>> fjs = nsiMappingService.fixturesAndJunctionsFor(p2ps, interval, oscarsConnectionId, strictPolicing);
fixtures = fjs.getLeft();
junctions = fjs.getRight();

Expand Down
5 changes: 3 additions & 2 deletions backend/src/test/java/net/es/oscars/cuke/NsiServiceSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private void setupMocks(Connection mockConn) throws Exception {
mockFixturesAndJunctions
).when(
mockNsiMappingService
).simpleComponents(Mockito.any(), Mockito.anyInt());
).simpleComponents(Mockito.any(), Mockito.anyInt(), Mockito.anyBoolean());

Mockito.doReturn(
mockFixturesAndJunctions
Expand All @@ -239,7 +239,8 @@ private void setupMocks(Connection mockConn) throws Exception {
).fixturesAndJunctionsFor(
Mockito.any(),
Mockito.any(),
Mockito.any()
Mockito.any(),
Mockito.anyBoolean()
);

// Mock the NsiMappingService.getP2PService() method.
Expand Down