Skip to content

Commit

Permalink
Fix data model example with new sids; fix condition in get_cc
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent committed Nov 25, 2024
1 parent 3f1528e commit 43c6221
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions examples/datamodel/data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@


print ("FULL SET OF RULES")
sor=rm.manipulate_coreconf(device="test:device1", sid=1000095) # get full conf
sor=rm.manipulate_coreconf(device="test:device1", sid=5095) # get full conf
pprint.pprint (sor)

print ("RULE 5/3")
Expand All @@ -49,23 +49,23 @@

print ("IPv6 VERSION TV")
ipv6_version_tv = rm.manipulate_coreconf(device="test:device1", sid="/ietf-schc:schc/rule/entry/target-value",
keys= [5, 3, 1000068, 1, 1000018])
keys= [5, 3, 5068, 1, 5018])
pprint.pprint (ipv6_version_tv)


print ("IPv6 VERSION VALUE")
ipv6_version_value = rm.manipulate_coreconf(device="test:device1", sid="/ietf-schc:schc/rule/entry/target-value/value",
keys= [5, 3, 1000068, 1, 1000018, 0])
keys= [5, 3, 5068, 1, 5018, 0])
pprint.pprint (ipv6_version_value)

print ("APP PREFIX TV")
app_prefix_tv = rm.manipulate_coreconf(device="test:device1", sid="/ietf-schc:schc/rule/entry/target-value",
keys= [5, 3, 1000057, 1, 1000018,])
keys= [5, 3, 5057, 1, 5018, 0])
pprint.pprint (app_prefix_tv)

print ("APP PREFIX VALUE 1")
app_prefix_tv = rm.manipulate_coreconf(device="test:device1", sid="/ietf-schc:schc/rule/entry/target-value/value",
keys= [5, 3, 1000057, 1, 1000018, 1])
keys= [5, 3, 5057, 1, 5018, 1])
pprint.pprint (app_prefix_tv)

print ("URI QUERY MSB VAL")
Expand Down Expand Up @@ -119,12 +119,12 @@

intermediary_result = rm.manipulate_coreconf(device="test:device1", sid="/ietf-schc:schc/rule",
keys=[6, 3],
value={33: 3, 34: 6, 35: 1000090})
value={33: 3, 34: 6, 35: 5090})
rm.Print()

print ("ADD A RULE")

intermediary_result = rm.manipulate_coreconf(device="test:device1", sid="/ietf-schc:schc/rule",
keys=[10, 8],
value={33: 8, 34: 10, 35: 1000090}, validate=dm) # 33: and 34: useless since in key
value={33: 8, 34: 10, 35: 5090}, validate=dm) # 33: and 34: useless since in key
rm.Print()
2 changes: 1 addition & 1 deletion src/gen_rulemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ def get_cc (self, sor, sid=None, keys = [], delta=0, ident=1, value=None):

if s+delta in self.sid_key_mapping: # A list we have keys, look for specific entry
# Raise an err if the number of SID keys are not the same as the number of keys in self.sid_key_mapping
if len(self.sid_key_mapping[s+delta]) != len(keys):
if len(self.sid_key_mapping[s+delta]) > len(keys):
raise ValueError ("Not enough keys values to locate the SID")

key_search = {}
Expand Down

0 comments on commit 43c6221

Please sign in to comment.