Skip to content

Commit

Permalink
gnmi: Disable YangDataService initialization
Browse files Browse the repository at this point in the history
Disable YangDataService initialization by using null configuration
parameters because this functionality has never worked correctly.

We have discovered the issue after bumping to yangtools 11.0.3
which contains https://jira.opendaylight.org/browse/YANGTOOLS-1539.

After adding "canCommit" phase we can see that data to be written
cannot pass the validation.

JIRA: LIGHTY-272
Signed-off-by: Ivan Hrasko <[email protected]>
Signed-off-by: tobias.pobocik <[email protected]>
  • Loading branch information
ihrasko authored and Tobianas committed Nov 29, 2023
1 parent f16c9fa commit 7750cff
Show file tree
Hide file tree
Showing 11 changed files with 160 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/lighty-rcgnmi-app/download_yangs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ wget https://raw.githubusercontent.com/openconfig/public/ed650bd969afc2eb5f66d60
wget https://raw.githubusercontent.com/openconfig/public/ed650bd969afc2eb5f66d60b86b62ffa6fd5fb8e/release/models/system/openconfig-system-terminal.yang -P yangs
wget https://raw.githubusercontent.com/openconfig/public/ed650bd969afc2eb5f66d60b86b62ffa6fd5fb8e/release/models/types/openconfig-types.yang -P yangs
wget https://raw.githubusercontent.com/openconfig/public/ed650bd969afc2eb5f66d60b86b62ffa6fd5fb8e/release/models/types/openconfig-yang-types.yang -P yangs
wget https://raw.githubusercontent.com/openconfig/public/f3349778e3cb3b0987f3ec18acea329ea4bf30e6/release/models/interfaces/openconfig-if-types.yang -P yangs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"gnmi_simulator":{
"targetAddress": "0.0.0.0",
"targetPort": 3333,
"initialStateDataPath": "./simulator/initialJsonData.json",
"initialConfigDataPath": "./simulator/initialJsonData.json",
"initialStateDataPath": "./simulator/initialStateJsonData.json",
"initialConfigDataPath": "./simulator/initialConfigJsonData.json",
"certPath": "./simulator/certs/server.crt",
"certKeyPath": "./simulator/certs/server.key",
"yangsPath": "./yangs",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"openconfig-interfaces:interfaces": {
"interface": [
{
"name": "admin",
"config": {
"name": "admin",
"type": "openconfig-if-types:IF_ETHERNET"
}
}
]
},
"openconfig-system:system": {
"aaa": {
"authentication": {
"admin-user": {
"config": {
"admin-password": "password"
}
},
"config": {
"authentication-method": [
"openconfig-aaa-types:LOCAL"
]
}
}
},
"clock": {
"config": {
"timezone-name": "Europe/Stockholm"
}
},
"config": {
"hostname": "zz-tri-dev01",
"domain-name": "foo.bar.com",
"login-banner": "This device is for authorized use only",
"motd-banner": "Welcome to Open vSwitch"
},
"openconfig-openflow:openflow": {
"agent": {
"config": {
"backoff-interval": 5,
"datapath-id": "10:16:3e:00:00:00:00:00",
"failure-mode": "SECURE",
"inactivity-probe": 10,
"max-backoff": 10
}
},
"controllers": {
"controller": [
{
"config": {
"name": "main"
},
"connections": {
"connection": [
{
"aux-id": 0,
"config": {
"address": "192.0.2.10",
"aux-id": 0,
"port": 6633,
"priority": 1,
"source-interface": "admin",
"transport": "TLS"
}
}
]
},
"name": "main"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ls -1 yangs
#Run simulator for testing purpose
printLine
echo -e "-- Starting gNMI simulator device --\n"
java -jar ${GITHUB_WORKSPACE}/lighty-modules/lighty-gnmi/lighty-gnmi-device-simulator/target/lighty-gnmi-device-simulator-20.0.0-SNAPSHOT.jar -c ./simulator/example_config.json > /dev/null 2>&1 &
java -jar ${GITHUB_WORKSPACE}/lighty-modules/lighty-gnmi/lighty-gnmi-device-simulator/target/lighty-gnmi-device-simulator-20.0.0-SNAPSHOT.jar -c ./simulator/example_config.json &

#Add yangs into controller through REST rpc
./add_yangs_via_rpc.sh
Expand Down Expand Up @@ -153,11 +153,6 @@ assertHttpStatusCode $(curl -X PUT -o /dev/null -s -w "%{http_code} PUT %{url_ef
"openconfig-aaa-types:TACACS_ALL"
]
},
"state": {
"authentication-method": [
"openconfig-aaa-types:RADIUS_ALL"
]
},
"admin-user": {
"config": {
"admin-password": "password"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ are performed on this device.

The application, lighty.io gNMI/RESTCONF is pre-prepared with [Openconfig YANG models](yangs).
These models are used by both gNMI application and gNMI device simulator. Device has already preconfigured state/config
data specified in [initialJsonData.json](simulator/initialJsonData.json) JSON file.
data specified in [initialStateJsonData.json.json](simulator/initialStateJsonData.json.json) JSON file.
To communicate with gNMI device it is required to use TLS communication with certificates and username and password
authorization.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"openconfig-interfaces:interfaces": {
"interface": [
{
"name": "admin",
"config": {
"name": "admin",
"type": "openconfig-if-types:IF_ETHERNET"
}
}
]
},
"openconfig-system:system": {
"aaa": {
"authentication": {
"admin-user": {
"config": {
"admin-password": "password"
}
},
"config": {
"authentication-method": [
"openconfig-aaa-types:LOCAL"
]
}
}
},
"clock": {
"config": {
"timezone-name": "Europe/Stockholm"
}
},
"config": {
"hostname": "zz-tri-dev01",
"domain-name": "foo.bar.com",
"login-banner": "This device is for authorized use only",
"motd-banner": "Welcome to Open vSwitch"
},
"openconfig-openflow:openflow": {
"agent": {
"config": {
"backoff-interval": 5,
"datapath-id": "00:16:3e:00:00:00:00:00",
"failure-mode": "SECURE",
"inactivity-probe": 10,
"max-backoff": 10
}
},
"controllers": {
"controller": [
{
"config": {
"name": "main"
},
"connections": {
"connection": [
{
"aux-id": 0,
"config": {
"address": "192.0.2.10",
"aux-id": 0,
"port": 6633,
"priority": 1,
"source-interface": "admin",
"transport": "TLS"
}
}
]
},
"name": "main"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"targetPort": 10161,
"certPath": "certificates/server.crt",
"certKeyPath": "certificates/server-pkcs8.key",
"initialConfigDataPath": "simulator/initialJsonData.json",
"initialStateDataPath": "simulator/initialJsonData.json",
"initialConfigDataPath": "simulator/initialConfigJsonData.json",
"initialStateDataPath": "simulator/initialStateJsonData.json",
"yangsPath": "../../lighty-models/openconfig-models/src/main/yang",
"username": "admin",
"password": "admin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public void start() throws IOException, EffectiveModelContextBuilderException {
.addYangModulesInfo(modulesInfoSet)
.build();

// Initialize data service
dataService = new YangDataService(schemaContext, initialConfigDataPath, initialStateDataPath);

// Route gNMI calls towards gNMI service facade
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private void modifyDataByPath(final DatastoreType datastoreType, final YangInsta
tx.merge(path, node);
}
final DOMStoreThreePhaseCommitCohort tpcc = tx.ready();
tpcc.canCommit().get();
tpcc.preCommit().get();
tpcc.commit().get();
} catch (final ExecutionException exception) {
Expand Down

0 comments on commit 7750cff

Please sign in to comment.