Skip to content

Development Environment

Jonathan Stout edited this page Jun 24, 2020 · 11 revisions

Working with your Database

Schema Changes

If you've made changes to the database schema you'll want to make sure the test databases are updated to reflect the change. To do this first ensure oess_test is not in mysql, then reload the database into mysql. We do this to ensure that all database fields are updated properly.

Before continuing: There are two test databases, t/conf/oess_known_state.sql and t/conf/mpls/discovery.sql. Be sure to update both whenever making schema changes.

mysql> drop database oess_test;
mysql> exit;
$ mysql -u root -p < t/conf/oess_known_state.sql

Next make your changes to the database schema.

$ mysql -u root -p oess_test
mysql> alter table node modify column maintenance_id int(11) NOT NULL;
mysql> quit;

After you've made your changes use mysql dump to save the modified database.

$ mysqldump -u root -p --databases oess_test > t/conf/oess_known_state.sql

Backups

If you'll be needing the data from your existing database again, use mysqldump to backup your database. This can be useful when switching between sets of test devices.

$ mysqldump -u root -p --databases oess > database-backup.sql

To reload your data:

$ mysql -u root -p
mysql> drop database oess;
mysql> quit
$ mysql -u root -p < database-backup.sql

Soft-Reset

A soft-reset removes all provisioned Connections and interface ownerships are removed. Run the following sql commands after selecting the oess database to perform a soft-reset.

delete from link_path_membership;
delete from path_instantiation_vlan_ids;
delete from path_instantiation;
delete from path;

delete from circuit_edge_interface_membership;
delete from circuit_instantiation;
delete from circuit;

delete from vrf_ep_peer;
delete from vrf_ep;
delete from vrf;

delete from cloud_connection_vrf_ep;

update interface set workgroup_id=NULL;

delete from user_entity_membership;

Hard-Reset

To remove all connections, approved network devices, and links first run the mysql commands from soft-reset then finish up with the below commands. No users or workgroups will be removed.

delete from link_instantiation;
delete from link;

delete from interface_acl;
delete from interface_instantiation;
delete from interface;

delete from node_instantiation;
delete from node;

Clone this wiki locally