Upgrading schema

In my old schema I had a ‘must’ statement.
I then changed my schema and removed the must statement.
When I changed the schema in my confd.cdb directory and then restart confd it still yells about this must restriction, and does not let me connect to the cli.

The way I upgrade the schema is by coying the aaa_init-*fxs, system-*.fxs, aaa_init-*.xml, and system-xsd-init-*.xml, where the wildcard stands for the version of the schema I just created.

I don’t completely understand how the yang upgrade process works, so I am not sure I am doing it right, although I do see my new files in confd.cdb.

Data Model Upgrade is described in Chapter 13 of the ConfD User Guide. You can also find examples for the same under examples.confd/in_service_upgrade.

Thank you very much for your response.

However, we do not perform an in-service upgrade. Why would the upgrade fail, then?

I read chapter 13 of the ConfD User Guide, but the only reference to my issue is this:

If the upgrade includes new validation points, or the validation logic for existing validation points
has changed, the new validators must connect to ConfD and register for their validation points before
maapi_commit_upgrade() is called.

My case is the second - validation logic has changed. However, I do not have a validation point, unless you consider a ‘must’ statement a validation point.

It is also not clear to me how performing the code assists me here: how do I permit the new, non-restrictive schema definition in the sequence described?

In short - I still do not understand why a removal of a constraint show fail the upgrade - the constraint is no longer in the schema, so how come confd thinks it’s still there?

Your assistance is much appreciated.

Let’s use an upgrade example that doesn’t make use of in-service upgrade.

If I modify cdb_upgrade/simple as follows:

localhost:my-simple$  diff ../simple .
diff ../simple/simple.yang ./simple.yang
30a31,34
>       must "(. mod 2) = 1" {
>         error-message "can only be an odd number";
>       }
> 
diff ../simple/simple_init.xml ./simple_init.xml
5c5
<   <simple:value3>-5</simple:value3>
---
>   <simple:value3>1</simple:value3>
localhost:my-simple$ 

I have added a must statement to the initial revision of the data model and then removed the must statement from the subsequent revision.

Following shows how I wasn’t able to configure value3 as an even number, but was able to after the upgrade when the must statement has been removed:

$ make clean all start
mkdir -p ./confd-cdb
cp $CONFD_DIR/var/confd/cdb/aaa_init.xml ./confd-cdb
ln -s $CONFD_DIR/etc/confd/ssh ssh-keydir
Build complete
: ### Stopping any confd daemon running
$CONFD_DIR/bin/confd --stop    || true
connection refused (stop)
$CONFD_DIR/bin/confdc --fail-on-warnings  -c -o simple.fxs  simple.yang
: ### Start the confd daemon using simple.fxs
cp simple_init.xml ./confd-cdb/simple_init.xml
$CONFD_DIR/bin/confd -c confd.conf --addloadpath $CONDF_DIR/etc/confd
: ### CDB will be initialized with simple_init.xml
: ### Inspect using "make query"
: ### Edit entries using command line interface "make cli"
: ### Then stop confd and start version 2, using "make start-v2"
$ make cli
$CONFD_DIR/bin/confd_cli --user=admin --groups=admin \
		--interactive || echo Exit

admin connected from 127.0.0.1 using console on localhost
admin@localhost> configure 
Entering configuration mode private
[ok][2017-08-21 15:15:11]

[edit]
admin@localhost% set simple value3 
Possible completions:
  <int>[1]
admin@localhost% set simple value3 2
[ok][2017-08-21 15:15:18]

[edit]
admin@localhost% commit
Aborted: 'simple value3' (value "2"): can only be an odd number
[error][2017-08-21 15:15:23]

[edit]
admin@localhost% exit
There are uncommitted changes.
Discard changes and continue? [yes,no] yes
[ok][2017-08-21 15:15:29]
admin@localhost> exit
$ make stop
: ### Stopping any confd daemon running
$CONFD_DIR/bin/confd --stop    || true
localhost:my-simple waitai1$ make start-v2
: ### Stopping any confd daemon running
$CONFD_DIR/bin/confd --stop    || true
connection refused (stop)
$CONFD_DIR/bin/confdc --fail-on-warnings  -c -o simple2.fxs  simple2.yang
: ### Remove the fxs file which is no longer valid
rm simple.fxs
: ### Remove the init file which is no longer valid
rm ./confd-cdb/simple_init.xml
: ### Start the confd daemon using simple.fxs version 2
$CONFD_DIR/bin/confd -c confd.conf --addloadpath $CONFD_DIR/etc/confd
: ### To see the result query the daemon using "make query"
$ make cli
$CONFD_DIR/bin/confd_cli --user=admin --groups=admin \
		--interactive || echo Exit

admin connected from 127.0.0.1 using console on localhost
admin@localhost> config
Entering configuration mode private
[ok][2017-08-21 15:15:50]

[edit]
admin@localhost% set simple value3 
Possible completions:
  <int>[1]
admin@localhost% set simple value3 2
[ok][2017-08-21 15:15:58]

[edit]
admin@localhost% commit
Commit complete.
[ok][2017-08-21 15:16:00]

[edit]
admin@localhost% exit
[ok][2017-08-21 15:16:01]
admin@localhost> exit
$