Skip to content

Commit

Permalink
Merge branch 'release-1.101.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
surabujin committed Aug 9, 2021
2 parents e166fcb + 59cfd56 commit c65310a
Show file tree
Hide file tree
Showing 360 changed files with 8,482 additions and 1,773 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## v1.101.0 (09/08/2021)

### Features:
- [#4380](https://github.com/telstra/open-kilda/pull/4380) Persistence layer implementation based on hibernate ORM [**storm-topologies**]

### Bug Fixes:
- [#4363](https://github.com/telstra/open-kilda/pull/4363) Fixed misconfigured meters (Issues: [#4366](https://github.com/telstra/open-kilda/issues/4366) [#4367](https://github.com/telstra/open-kilda/issues/4367)) [**floodlight**][**storm-topologies**]
- [#4408](https://github.com/telstra/open-kilda/pull/4408) Forbid QinQ flows for WB-series switches
- [#4393](https://github.com/telstra/open-kilda/pull/4393) fixes direct links in gui README.md file [**gui**]

### Improvements:
- [#4376](https://github.com/telstra/open-kilda/pull/4376) Rearrange history models naming scheme [**storm-topologies**]
- [#4388](https://github.com/telstra/open-kilda/pull/4388) Improve flow monitoring cache init
- [#4356](https://github.com/telstra/open-kilda/pull/4356) extract isVxlanEnabled into switchHelper [**tests**]
- [#4399](https://github.com/telstra/open-kilda/pull/4399) Fix flow monitoring parallelism issue
- [#4369](https://github.com/telstra/open-kilda/pull/4369) test for s42 + wb switch [**tests**]
- [#4311](https://github.com/telstra/open-kilda/pull/4311) Toolset to migrate histrory data between OrientDB and MySQL
- [#4379](https://github.com/telstra/open-kilda/pull/4379) Test/fix unstable [**tests**]
- [#4382](https://github.com/telstra/open-kilda/pull/4382) Improvement/derby to mysql migration [**gui**]
- [#4383](https://github.com/telstra/open-kilda/pull/4383) fix/refactor unstable func tests [**tests**]
- [#4384](https://github.com/telstra/open-kilda/pull/4384) Move single-table mode tests to low_prio [**tests**]

For the complete list of changes, check out [the commit log](https://github.com/telstra/open-kilda/compare/v1.100.0...v1.101.0).

### Affected Components:
isllatency, nbworker, router, ping, reroute, fl, swmanager, gui, flow-hs, network, flow-monitor

### Upgrade notes:
OrientDB schema have been changed in this release. You need to apply schema migration. Please follow [migration instructions](https://github.com/telstra/open-kilda/tree/develop/docker/db-migration/migrations).

---

## v1.100.0 (26/07/2021)

### Bug Fixes:
Expand Down
7 changes: 7 additions & 0 deletions confd/templates/base-storm-topology/topology.properties.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ bfd.port.offset = {{ getv "/kilda_bfd_port_offset" }}
zookeeper.connect_string = {{ getv "/kilda_zookeeper_hosts"}}/{{ getv "/kilda_zookeeper_state_root" }}
zookeeper.reconnect_delay={{ getv "/kilda_zookeeper_reconnect_delay_ms"}}

persistence.implementation = {{ getv "/kilda_persistence_implementation" }}

opentsdb.hosts = http://{{ getv "/kilda_opentsdb_hosts" }}:{{ getv "/kilda_opentsdb_port" }}
opentsdb.timeout = {{ getv "/kilda_opentsdb_timeout" }}
opentsdb.batch.size = {{ getv "/kilda_opentsdb_batch_size" }}
Expand All @@ -55,6 +57,11 @@ opentsdb.metric.prefix = {{ getv "/kilda_opentsdb_metric_prefix" }}

statistics.interval = {{ getv "/kilda_statistics_interval" }}

hibernate.user = {{ getv "/kilda_hibernate_user" }}
hibernate.password = {{ getv "/kilda_hibernate_password" }}
hibernate.url = {{ getv "/kilda_hibernate_url" }}
#hibernate.driver_class = com.mysql.jdbc.Driver

{{if not (exists "/single_orientdb")}}
orientdb.url=remote:{{ getv "/kilda_orientdb_hosts" }}/{{ getv "/kilda_orientdb_database" }}
{{else}}
Expand Down
23 changes: 23 additions & 0 deletions confd/templates/docker-compose/docker-compose.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,28 @@ services:
- odb3.pendev
{{end}}

mysql_db:
hostname: mysql.pendev
image: mysql:5.6
command: --default-authentication-plugin=mysql_native_password
volumes:
- ./docker/mysql/setup_data:/docker-entrypoint-initdb.d
- sql_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: "mysql-root"
MYSQL_ONETIME_PASSWORD: "yes"
MYSQL_DATABASE: "kilda"
MYSQL_USER: "kilda"
MYSQL_PASSWORD: "kilda"
ports:
- 8101:3306
healthcheck:
test: "mysqladmin -u kilda -pkilda ping"
networks:
default:
aliases:
- mysql.pendev

db_migration:
container_name: db_migration
build: docker/db-migration
Expand Down Expand Up @@ -775,3 +797,4 @@ volumes:
odb2_data:
odb3_data:
{{end}}
sql_data:
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ bolts:
parallelism: 1
- id: "TICK_BOLT"
parallelism: 1
- id: "FLOW_STATE_CACHE_BOLT"
parallelism: 1
8 changes: 5 additions & 3 deletions confd/templates/gui/application.properties.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ server.ssl.key-store-password = openkilda

#Derby database configuration (In Memory)
spring.jpa.database=default
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.DerbyTenSevenDialect
spring.jpa.properties.hibernate.dialect={{ getv "/kilda_gui_db_dialect" }}

spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.enable_lazy_load_no_trans=true

spring.datasource.url=jdbc:derby:/app/data/database;create=true
spring.datasource.driver-class-name=org.apache.derby.jdbc.EmbeddedDriver
spring.datasource.url={{ getv "/kilda_gui_db_url" }}
spring.datasource.username={{ getv "/kilda_gui_db_username" }}
spring.datasource.password={{ getv "/kilda_gui_db_password" }}


# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testOnBorrow: true
Expand Down
14 changes: 13 additions & 1 deletion confd/vars/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ kilda_orientdb_user: "kilda"
kilda_orientdb_password: "kilda"
kilda_orientdb_database: "kilda"

kilda_persistence_implementation: "orientdb"
#kilda_persistence_implementation: "orientdb-sql-mixture1"

kilda_kafka_hosts: "kafka.pendev:9092"
kilda_zookeeper_hosts: "zookeeper.pendev"
kilda_zookeeper_state_root: "kilda"
Expand All @@ -20,7 +23,17 @@ kilda_opentsdb_hosts: "opentsdb.pendev"
kilda_opentsdb_port: "4242"
kilda_storm_numbus_hosts: "nimbus.pendev"

kilda_hibernate_user: kilda
kilda_hibernate_password: kilda
kilda_hibernate_url: jdbc:mysql://mysql.pendev:3306/kilda

kilda_gui_port: 1010
kilda_gui_db_dialect: org.hibernate.dialect.DerbyTenSevenDialect
kilda_gui_db_url: jdbc:derby:/app/data/database;create=true
kilda_gui_db_username: ''
kilda_gui_db_password: ''
kilda_gui_application_name_prefix: "Dev"

kilda_smtp_host: "127.0.0.1"
kilda_smtp_port: "25"
kilda_mail_from: "[email protected]"
Expand Down Expand Up @@ -141,7 +154,6 @@ kilda_logging_port_server42_control_server_stub: 5008
kilda_logging_port_server42_control_storm_stub: 5009
kilda_logging_port_tests: 5006

kilda_gui_application_name_prefix: "Dev"

kilda_grpc_endpoint: "http://grpc-speaker.pendev"
kilda_grpc_rest_port: "8091"
Expand Down
2 changes: 1 addition & 1 deletion docker/base/hacks/storm.requirements.download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PROJECT_ROOT=$(cd "$(dirname "$0")/../.."; pwd)

TARGET=${PROJECT_ROOT}/storm/lib

JACKSON_VERSION=2.9.3
JACKSON_VERSION=2.10.0

CLI="mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:copy"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
databaseChangeLog:
- changeSet:
id: tag
author: surabujin
changes:
- tagDatabase:
tag: 010-enforce-definite-types-on-history-objects

- changeSet:
id: add_unique_index_for_port_history
author: surabujin
changes:
- sql: "CREATE PROPERTY port_history.id IF NOT EXISTS STRING"
- sql: "CREATE INDEX port_history.id UNIQUE_HASH_INDEX"
rollback:
- sql: "DROP INDEX port_history.id"
- sql: "DROP PROPERTY port_history.id"

- changeSet:
id: enforce_definite_types_for_flow_dump_objects
author: surabujin
changes:
- sql: "CREATE PROPERTY flow_dump.bandwidth IF NOT EXISTS LONG"
- sql: "CREATE PROPERTY flow_dump.forward_cookie IF NOT EXISTS LONG"
- sql: "CREATE PROPERTY flow_dump.reverse_cookie IF NOT EXISTS LONG"
- sql: "CREATE PROPERTY flow_dump.src_port IF NOT EXISTS INTEGER"
- sql: "CREATE PROPERTY flow_dump.dst_port IF NOT EXISTS INTEGER"
- sql: "CREATE PROPERTY flow_dump.src_vlan IF NOT EXISTS INTEGER"
- sql: "CREATE PROPERTY flow_dump.dst_vlan IF NOT EXISTS INTEGER"
- sql: "CREATE PROPERTY flow_dump.src_inner_vlan IF NOT EXISTS INTEGER"
- sql: "CREATE PROPERTY flow_dump.dst_inner_vlan IF NOT EXISTS INTEGER"
- sql: "CREATE PROPERTY flow_dump.forward_meter_id IF NOT EXISTS LONG"
- sql: "CREATE PROPERTY flow_dump.reverse_meter_id IF NOT EXISTS LONG"
- sql: "CREATE PROPERTY flow_dump.max_latency IF NOT EXISTS LONG"
rollback:
- sql: "DROP PROPERTY flow_dump.max_latency"
- sql: "DROP PROPERTY flow_dump.reverse_meter_id"
- sql: "DROP PROPERTY flow_dump.forward_meter_id"
- sql: "DROP PROPERTY flow_dump.dst_inner_vlan"
- sql: "DROP PROPERTY flow_dump.src_inner_vlan"
- sql: "DROP PROPERTY flow_dump.dst_vlan"
- sql: "DROP PROPERTY flow_dump.src_vlan"
- sql: "DROP PROPERTY flow_dump.dst_port"
- sql: "DROP PROPERTY flow_dump.src_port"
- sql: "DROP PROPERTY flow_dump.reverse_cookie"
- sql: "DROP PROPERTY flow_dump.forward_cookie"
- sql: "DROP PROPERTY flow_dump.bandwidth"
3 changes: 3 additions & 0 deletions docker/db-migration/migrations/root.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ databaseChangeLog:
- include:
relativeToChangelogFile: true
file: 009-cleanup-config-class.yaml
- include:
relativeToChangelogFile: true
file: 010-enforce-definite-types-on-history-objects.yaml
59 changes: 59 additions & 0 deletions docker/mysql/setup_data/initial-schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
-- initial mysql schema

CREATE TABLE flow_event
(
id integer primary key auto_increment,
flow_id text not null,
task_id text not null,
task_id_unique_key char(100) not null,
action text not null,
unstructured text not null,
time_create datetime(3) not null default now(3),
time_modify datetime(3),
event_time datetime(3),
index `ix_event_time` (event_time),
index `ix_flow_id` (flow_id(64)),
unique `ix_task_id` (task_id_unique_key(100))
);

CREATE TABLE flow_event_action
(
id integer primary key auto_increment,
flow_event_id integer not null,
action text not null,
details text,
time_create datetime(3) not null default now(3),
time_modify datetime(3),
event_time datetime(3),
index `ix_flow_event_id` (flow_event_id),
foreign key `fk_flow_event_action_2_flow_event` (flow_event_id)
REFERENCES flow_event(id)
ON UPDATE CASCADE ON DELETE RESTRICT
);

CREATE TABLE flow_event_dump
(
id integer primary key auto_increment,
flow_event_id integer not null,
kind varchar(64) not null,
unstructured text not null,
time_create datetime(3) not null default now(3),
time_modify datetime(3),
index `ix_flow_event_id` (flow_event_id),
foreign key `fk_flow_event_dump_2_flow_event` (flow_event_id)
REFERENCES flow_event (id)
ON UPDATE CASCADE ON DELETE RESTRICT
);

CREATE TABLE port_event
(
id char(36) primary key, -- uuid
switch_id char(23) not null,
port_number integer not null,
event varchar(64) not null,
unstructured text not null,
time_create datetime(3) not null default now(3),
time_modify datetime(3),
event_time datetime(3),
index `ix_event_time` (event_time)
);
6 changes: 5 additions & 1 deletion docs/design/hub-and-spoke/switch-sync/switch-sync-fsm.dot
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ COMPUTE_MISCONFIGURED_RULES [label="COMPUTE_MISCONFIGURED_RULES"];
FINISHED [label="FINISHED"];
FINISHED_WITH_ERROR [label="FINISHED_WITH_ERROR"];
COMPUTE_EXCESS_METERS [label="COMPUTE_EXCESS_METERS"];
COMPUTE_MISCONFIGURED_METERS [label="COMPUTE_MISCONFIGURED_METERS"];

GROUPS_COMMANDS_SEND -> GROUPS_COMMANDS_SEND [ label="GROUPS_INSTALLED"];
GROUPS_COMMANDS_SEND -> GROUPS_COMMANDS_SEND [ label="GROUPS_MODIFIED"];
Expand All @@ -27,6 +28,7 @@ RULES_COMMANDS_SEND -> FINISHED_WITH_ERROR [ label="TIMEOUT"];
RULES_COMMANDS_SEND -> FINISHED_WITH_ERROR [ label="ERROR"];
RULES_COMMANDS_SEND -> METERS_COMMANDS_SEND [ label="RULES_SYNCHRONIZED"];
METERS_COMMANDS_SEND -> METERS_COMMANDS_SEND [ label="METERS_REMOVED"];
METERS_COMMANDS_SEND -> METERS_COMMANDS_SEND [ label="MISCONFIGURED_METERS_MODIFIED"];
METERS_COMMANDS_SEND -> FINISHED_WITH_ERROR [ label="TIMEOUT"];
METERS_COMMANDS_SEND -> FINISHED_WITH_ERROR [ label="ERROR"];
METERS_COMMANDS_SEND -> FINISHED [ label="NEXT"];
Expand All @@ -40,4 +42,6 @@ COMPUTE_MISSING_RULES -> COMPUTE_MISCONFIGURED_RULES [ label="NEXT"];
COMPUTE_MISCONFIGURED_RULES -> FINISHED_WITH_ERROR [ label="ERROR"];
COMPUTE_MISCONFIGURED_RULES -> COMPUTE_EXCESS_RULES [ label="NEXT"];
COMPUTE_EXCESS_METERS -> FINISHED_WITH_ERROR [ label="ERROR"];
COMPUTE_EXCESS_METERS -> COMPUTE_GROUP_MIRROR_CONFIGS [ label="NEXT"];}}
COMPUTE_EXCESS_METERS -> COMPUTE_MISCONFIGURED_METERS [ label="NEXT"];
COMPUTE_MISCONFIGURED_METERS -> FINISHED_WITH_ERROR [ label="ERROR"];
COMPUTE_MISCONFIGURED_METERS -> COMPUTE_GROUP_MIRROR_CONFIGS [ label="NEXT"];}}
Binary file modified docs/design/hub-and-spoke/switch-sync/switch-sync-fsm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions docs/gui/ApacheDerbyToMySQLMigration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Apache Derby To MySQL Migration
## _Objective :_

Goal of this document is to provide a stepwise guide to migrate your application from using Apache Derby to MySQL. We need to ensure that exported data structure is compatible with MySQL so that data can be imported to MySQL without any issue.

## Pre-requisite:

- **Required JAVA:** To check if JAVA_HOME is setup run below command
- ```echo $JAVA_HOME```
- **Required MySQL:** Click [here](https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/) to view Mysql Installation guide
- **Script Files** : Below mentioned script files that are needed for complete migration and are available [here](/tools/derby-to-mysql-migration/script-files).
**a. derbymysqlmigration.sh:** bash file that contains script to setup and install derby tools (dblook and ij). script to connect to ij and export the derby data to CSV files. These CSV files will later be used to import the data in MYSQL.
**b. derby-mysql-import.sh:** bash file that contains the script which will lookup the derby db metadata in form of SQLs and then will update those SQLs to make them compatible with MYSQL and will create a MySQL compatible .sql metadata file. Then will create the database, along with tables and import all the table records.
**c. derby-export.sql:** sql file that contains scripts to export the data from each Derby db table into CSV files.
**d. derby-import.sql:** sql file that contains commands to import the data in MYSQL database tables.
**e. derby.properties:** properties file to configure MySQL Database
**f. input.txt:** input file for IJ configuration

## Migration

User will have to navigate to below mentioned location and execute following commands:

- ```cd /tools/derby-to-mysql-migration```
- ```make pre-req "olddb=<oldDBName>" "newdb=<newDBName>" "derbydb=<derbyDBPath>"```

**a. oldDBName:** Derby database name, which is SA by default
**b. newDBName:** Name of the database you want to create in MySQL
**c. derbyDBPath:** Path of your existing Derby database
- Stop the application that is running with Derby database from which DB migration has to be done, in order to avoid any data loss. Also, this is mandatory for the successful execution of bash scripts.

## Export & Import metadata and data from existing Derby to MySQL DB:
- ```make export```
- ```make import```

This will lookup the metadata in form of SQLs and then will update those SQLs to make them compatible to MySQL. On execution, It will create the database in MySQL, along with all the tables and will also import all the records in db tables. **It will promt you for MySQL password twice**.

## Verification
Follow below mentioned steps to Verify if scripts execution is successful and database is created successfully along with each table and its records.
- ```mysql -u root -p ```
Enter Password:
- ```mysql> use {dbname};```
- ```mysql> show tables;```
- ```mysql> select * from {tablename};```
## Cleanup
In case there's a failure in migration at any step, first navigate to /opt directory and execute below command to cleanup the process and then start again from scratch i.e by navigating to /tools/derby-to-mysql-migration directory and then execute commands.

- ```cd /opt```
- ```rm -rf /opt/derby```
File renamed without changes.
22 changes: 19 additions & 3 deletions src-gui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,25 @@ Some other commands will run in openkilda-gui directory :
+ ```make stop```

----
### MySQL Support
By default, application is running with Apache Derby Database. In order to run the application with MySQL database, you'll have to update following properties in [main.yaml](/confd/vars/main.yaml) file.
>kilda_gui_db_dialect: org.hibernate.dialect.MySQL5Dialect
### User Documentation
>kilda_gui_db_url:
>kilda_gui_db_username:
>kilda_gui_db_password:
> See `README.user.releases.md` for view user documentation.
where
**kilda_gui_db_url** will be url to MySQL database along with database name
Example:- jdbc:mysql://127.0.0.1:3306/dbname
**kilda_gui_db_username** will be DB username
**kilda_gui_db_password** will be DB password
### MySQL Migration
> See [Apache Derby To MySQL Migration](/docs/gui/ApacheDerbyToMySQLMigration.md) to view migration documention for migrating databasae from Derby to MySQL.

### User Documentation

[README.user.releases]: README.user.releases.md
> See [README.user.releases](/docs/gui/README.user.releases.md) for view user documentation.
1 change: 1 addition & 0 deletions src-gui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies {
implementation 'net.logstash.logback:logstash-logback-encoder:4.7'
implementation 'javax.xml.bind:jaxb-api:2.1'
implementation 'org.apache.derby:derby:10.12.1.1'
implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.12'
implementation 'org.apache.velocity:velocity:1.7'
implementation 'org.apache.commons:commons-io:1.3.2'
implementation 'com.ibatis:ibatis2-common:2.1.7.597'
Expand Down
Loading

0 comments on commit c65310a

Please sign in to comment.