Re: [ovs-dev] [PATCH ovn v2 2/5] Add NB and SB Template_Var tables.

2022-11-22 Thread Dumitru Ceara
On 11/16/22 22:33, Mark Michelson wrote:
> Hi Dumitru, I have a few comments below.

Hi Mark,

Thanks for your review!

> 
> On 11/4/22 18:11, Dumitru Ceara wrote:
>> Propagate the contents of the NB table to the Southbound.
>>
>> Signed-off-by: Dumitru Ceara 
>> ---
>> Note:
>> - ovn-trace doesn't support template variables (yet).
>>
>> V2:
>> - Fixed TEMPLATE_VAR_TABLE_INITIALIZER definition so that GCC doesn't
>>    complain anymore.
>> - Addressed Han's comments:
>>    - Rename tables to Chassis_Template_Var.
>>    - Fix man page.
>>    - Simplify function prototypes.
>> - Changed schema as suggested by Ilya.
>> ---
>>   northd/automake.mk   |    4 ++
>>   northd/en-northd.c   |    4 ++
>>   northd/inc-proc-northd.c |    8 -
>>   northd/northd.c  |   41 +
>>   northd/northd.h  |    4 ++
>>   northd/template-var.c    |   74
>> ++
>>   northd/template-var.h    |   58 
>>   ovn-nb.ovsschema |   17 +--
>>   ovn-nb.xml   |   29 ++
>>   ovn-sb.ovsschema |   12 ++-
>>   ovn-sb.xml   |   15 +
>>   tests/ovn-northd.at  |   35 ++
>>   utilities/ovn-nbctl.c    |    3 ++
>>   utilities/ovn-sbctl.c    |    3 ++
>>   14 files changed, 299 insertions(+), 8 deletions(-)
>>   create mode 100644 northd/template-var.c
>>   create mode 100644 northd/template-var.h
>>
>> diff --git a/northd/automake.mk b/northd/automake.mk
>> index 81582867dc..31134bc329 100644
>> --- a/northd/automake.mk
>> +++ b/northd/automake.mk
>> @@ -13,7 +13,9 @@ northd_ovn_northd_SOURCES = \
>>   northd/inc-proc-northd.c \
>>   northd/inc-proc-northd.h \
>>   northd/ipam.c \
>> -    northd/ipam.h
>> +    northd/ipam.h \
>> +    northd/template-var.c \
>> +    northd/template-var.h
>>   northd_ovn_northd_LDADD = \
>>   lib/libovn.la \
>>   $(OVSDB_LIBDIR)/libovsdb.la \
>> diff --git a/northd/en-northd.c b/northd/en-northd.c
>> index 7fe83db642..030ee25d8f 100644
>> --- a/northd/en-northd.c
>> +++ b/northd/en-northd.c
>> @@ -80,6 +80,8 @@ void en_northd_run(struct engine_node *node, void
>> *data)
>>   EN_OVSDB_GET(engine_get_input("NB_acl", node));
>>   input_data.nbrec_static_mac_binding_table =
>>   EN_OVSDB_GET(engine_get_input("NB_static_mac_binding", node));
>> +    input_data.nbrec_chassis_template_var_table =
>> +    EN_OVSDB_GET(engine_get_input("NB_chassis_template_var", node));
>>     input_data.sbrec_sb_global_table =
>>   EN_OVSDB_GET(engine_get_input("SB_sb_global", node));
>> @@ -113,6 +115,8 @@ void en_northd_run(struct engine_node *node, void
>> *data)
>>   EN_OVSDB_GET(engine_get_input("SB_chassis_private", node));
>>   input_data.sbrec_static_mac_binding_table =
>>   EN_OVSDB_GET(engine_get_input("SB_static_mac_binding", node));
>> +    input_data.sbrec_chassis_template_var_table =
>> +    EN_OVSDB_GET(engine_get_input("SB_chassis_template_var", node));
>>     northd_run(_data, data,
>>  eng_ctx->ovnnb_idl_txn,
>> diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
>> index 54e0ad3b05..da791f035d 100644
>> --- a/northd/inc-proc-northd.c
>> +++ b/northd/inc-proc-northd.c
>> @@ -64,7 +64,8 @@ VLOG_DEFINE_THIS_MODULE(inc_proc_northd);
>>   NB_NODE(ha_chassis_group, "ha_chassis_group") \
>>   NB_NODE(ha_chassis, "ha_chassis") \
>>   NB_NODE(bfd, "bfd") \
>> -    NB_NODE(static_mac_binding, "static_mac_binding")
>> +    NB_NODE(static_mac_binding, "static_mac_binding") \
>> +    NB_NODE(chassis_template_var, "chassis_template_var")
>>     enum nb_engine_node {
>>   #define NB_NODE(NAME, NAME_STR) NB_##NAME,
>> @@ -114,7 +115,8 @@ VLOG_DEFINE_THIS_MODULE(inc_proc_northd);
>>   SB_NODE(load_balancer, "load_balancer") \
>>   SB_NODE(bfd, "bfd") \
>>   SB_NODE(fdb, "fdb") \
>> -    SB_NODE(static_mac_binding, "static_mac_binding")
>> +    SB_NODE(static_mac_binding, "static_mac_binding") \
>> +    SB_NODE(chassis_template_var, "chassis_template_var")
>>     enum sb_engine_node {
>>   #define SB_NODE(NAME, NAME_STR) SB_##NAME,
>> @@ -186,6 +188,7 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>>   engine_add_input(_northd, _nb_ha_chassis_group, NULL);
>>   engine_add_input(_northd, _nb_ha_chassis, NULL);
>>   engine_add_input(_northd, _nb_static_mac_binding, NULL);
>> +    engine_add_input(_northd, _nb_chassis_template_var, NULL);
>>     engine_add_input(_northd, _sb_sb_global, NULL);
>>   engine_add_input(_northd, _sb_chassis, NULL);
>> @@ -215,6 +218,7 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>>   engine_add_input(_northd, _sb_load_balancer, NULL);
>>   engine_add_input(_northd, _sb_fdb, NULL);
>>   engine_add_input(_northd, _sb_static_mac_binding, NULL);
>> +    engine_add_input(_northd, _sb_chassis_template_var, 

Re: [ovs-dev] [PATCH ovn v2 2/5] Add NB and SB Template_Var tables.

2022-11-16 Thread Mark Michelson

Hi Dumitru, I have a few comments below.

On 11/4/22 18:11, Dumitru Ceara wrote:

Propagate the contents of the NB table to the Southbound.

Signed-off-by: Dumitru Ceara 
---
Note:
- ovn-trace doesn't support template variables (yet).

V2:
- Fixed TEMPLATE_VAR_TABLE_INITIALIZER definition so that GCC doesn't
   complain anymore.
- Addressed Han's comments:
   - Rename tables to Chassis_Template_Var.
   - Fix man page.
   - Simplify function prototypes.
- Changed schema as suggested by Ilya.
---
  northd/automake.mk   |4 ++
  northd/en-northd.c   |4 ++
  northd/inc-proc-northd.c |8 -
  northd/northd.c  |   41 +
  northd/northd.h  |4 ++
  northd/template-var.c|   74 ++
  northd/template-var.h|   58 
  ovn-nb.ovsschema |   17 +--
  ovn-nb.xml   |   29 ++
  ovn-sb.ovsschema |   12 ++-
  ovn-sb.xml   |   15 +
  tests/ovn-northd.at  |   35 ++
  utilities/ovn-nbctl.c|3 ++
  utilities/ovn-sbctl.c|3 ++
  14 files changed, 299 insertions(+), 8 deletions(-)
  create mode 100644 northd/template-var.c
  create mode 100644 northd/template-var.h

diff --git a/northd/automake.mk b/northd/automake.mk
index 81582867dc..31134bc329 100644
--- a/northd/automake.mk
+++ b/northd/automake.mk
@@ -13,7 +13,9 @@ northd_ovn_northd_SOURCES = \
northd/inc-proc-northd.c \
northd/inc-proc-northd.h \
northd/ipam.c \
-   northd/ipam.h
+   northd/ipam.h \
+   northd/template-var.c \
+   northd/template-var.h
  northd_ovn_northd_LDADD = \
lib/libovn.la \
$(OVSDB_LIBDIR)/libovsdb.la \
diff --git a/northd/en-northd.c b/northd/en-northd.c
index 7fe83db642..030ee25d8f 100644
--- a/northd/en-northd.c
+++ b/northd/en-northd.c
@@ -80,6 +80,8 @@ void en_northd_run(struct engine_node *node, void *data)
  EN_OVSDB_GET(engine_get_input("NB_acl", node));
  input_data.nbrec_static_mac_binding_table =
  EN_OVSDB_GET(engine_get_input("NB_static_mac_binding", node));
+input_data.nbrec_chassis_template_var_table =
+EN_OVSDB_GET(engine_get_input("NB_chassis_template_var", node));
  
  input_data.sbrec_sb_global_table =

  EN_OVSDB_GET(engine_get_input("SB_sb_global", node));
@@ -113,6 +115,8 @@ void en_northd_run(struct engine_node *node, void *data)
  EN_OVSDB_GET(engine_get_input("SB_chassis_private", node));
  input_data.sbrec_static_mac_binding_table =
  EN_OVSDB_GET(engine_get_input("SB_static_mac_binding", node));
+input_data.sbrec_chassis_template_var_table =
+EN_OVSDB_GET(engine_get_input("SB_chassis_template_var", node));
  
  northd_run(_data, data,

 eng_ctx->ovnnb_idl_txn,
diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
index 54e0ad3b05..da791f035d 100644
--- a/northd/inc-proc-northd.c
+++ b/northd/inc-proc-northd.c
@@ -64,7 +64,8 @@ VLOG_DEFINE_THIS_MODULE(inc_proc_northd);
  NB_NODE(ha_chassis_group, "ha_chassis_group") \
  NB_NODE(ha_chassis, "ha_chassis") \
  NB_NODE(bfd, "bfd") \
-NB_NODE(static_mac_binding, "static_mac_binding")
+NB_NODE(static_mac_binding, "static_mac_binding") \
+NB_NODE(chassis_template_var, "chassis_template_var")
  
  enum nb_engine_node {

  #define NB_NODE(NAME, NAME_STR) NB_##NAME,
@@ -114,7 +115,8 @@ VLOG_DEFINE_THIS_MODULE(inc_proc_northd);
  SB_NODE(load_balancer, "load_balancer") \
  SB_NODE(bfd, "bfd") \
  SB_NODE(fdb, "fdb") \
-SB_NODE(static_mac_binding, "static_mac_binding")
+SB_NODE(static_mac_binding, "static_mac_binding") \
+SB_NODE(chassis_template_var, "chassis_template_var")
  
  enum sb_engine_node {

  #define SB_NODE(NAME, NAME_STR) SB_##NAME,
@@ -186,6 +188,7 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
  engine_add_input(_northd, _nb_ha_chassis_group, NULL);
  engine_add_input(_northd, _nb_ha_chassis, NULL);
  engine_add_input(_northd, _nb_static_mac_binding, NULL);
+engine_add_input(_northd, _nb_chassis_template_var, NULL);
  
  engine_add_input(_northd, _sb_sb_global, NULL);

  engine_add_input(_northd, _sb_chassis, NULL);
@@ -215,6 +218,7 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
  engine_add_input(_northd, _sb_load_balancer, NULL);
  engine_add_input(_northd, _sb_fdb, NULL);
  engine_add_input(_northd, _sb_static_mac_binding, NULL);
+engine_add_input(_northd, _sb_chassis_template_var, NULL);
  engine_add_input(_mac_binding_aging, _nb_nb_global, NULL);
  engine_add_input(_mac_binding_aging, _sb_mac_binding, NULL);
  engine_add_input(_mac_binding_aging, _northd, NULL);
diff --git a/northd/northd.c b/northd/northd.c
index b7388afc58..170b4f95c8 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -51,6 +51,7 @@
  #include 

Re: [ovs-dev] [PATCH ovn v2 2/5] Add NB and SB Template_Var tables.

2022-11-04 Thread 0-day Robot
Bleep bloop.  Greetings Dumitru Ceara, I am a robot and I have tried out your 
patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Inappropriate bracing around statement
#314 FILE: northd/template-var.h:36:
HMAP_FOR_EACH (NODE, hmap_node, &(TBL)->vars)

Lines checked: 535, Warnings: 0, Errors: 1


Please check this out.  If you feel there has been an error, please email 
acon...@redhat.com

Thanks,
0-day Robot
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH ovn v2 2/5] Add NB and SB Template_Var tables.

2022-11-04 Thread Dumitru Ceara
Propagate the contents of the NB table to the Southbound.

Signed-off-by: Dumitru Ceara 
---
Note:
- ovn-trace doesn't support template variables (yet).

V2:
- Fixed TEMPLATE_VAR_TABLE_INITIALIZER definition so that GCC doesn't
  complain anymore.
- Addressed Han's comments:
  - Rename tables to Chassis_Template_Var.
  - Fix man page.
  - Simplify function prototypes.
- Changed schema as suggested by Ilya.
---
 northd/automake.mk   |4 ++
 northd/en-northd.c   |4 ++
 northd/inc-proc-northd.c |8 -
 northd/northd.c  |   41 +
 northd/northd.h  |4 ++
 northd/template-var.c|   74 ++
 northd/template-var.h|   58 
 ovn-nb.ovsschema |   17 +--
 ovn-nb.xml   |   29 ++
 ovn-sb.ovsschema |   12 ++-
 ovn-sb.xml   |   15 +
 tests/ovn-northd.at  |   35 ++
 utilities/ovn-nbctl.c|3 ++
 utilities/ovn-sbctl.c|3 ++
 14 files changed, 299 insertions(+), 8 deletions(-)
 create mode 100644 northd/template-var.c
 create mode 100644 northd/template-var.h

diff --git a/northd/automake.mk b/northd/automake.mk
index 81582867dc..31134bc329 100644
--- a/northd/automake.mk
+++ b/northd/automake.mk
@@ -13,7 +13,9 @@ northd_ovn_northd_SOURCES = \
northd/inc-proc-northd.c \
northd/inc-proc-northd.h \
northd/ipam.c \
-   northd/ipam.h
+   northd/ipam.h \
+   northd/template-var.c \
+   northd/template-var.h
 northd_ovn_northd_LDADD = \
lib/libovn.la \
$(OVSDB_LIBDIR)/libovsdb.la \
diff --git a/northd/en-northd.c b/northd/en-northd.c
index 7fe83db642..030ee25d8f 100644
--- a/northd/en-northd.c
+++ b/northd/en-northd.c
@@ -80,6 +80,8 @@ void en_northd_run(struct engine_node *node, void *data)
 EN_OVSDB_GET(engine_get_input("NB_acl", node));
 input_data.nbrec_static_mac_binding_table =
 EN_OVSDB_GET(engine_get_input("NB_static_mac_binding", node));
+input_data.nbrec_chassis_template_var_table =
+EN_OVSDB_GET(engine_get_input("NB_chassis_template_var", node));
 
 input_data.sbrec_sb_global_table =
 EN_OVSDB_GET(engine_get_input("SB_sb_global", node));
@@ -113,6 +115,8 @@ void en_northd_run(struct engine_node *node, void *data)
 EN_OVSDB_GET(engine_get_input("SB_chassis_private", node));
 input_data.sbrec_static_mac_binding_table =
 EN_OVSDB_GET(engine_get_input("SB_static_mac_binding", node));
+input_data.sbrec_chassis_template_var_table =
+EN_OVSDB_GET(engine_get_input("SB_chassis_template_var", node));
 
 northd_run(_data, data,
eng_ctx->ovnnb_idl_txn,
diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
index 54e0ad3b05..da791f035d 100644
--- a/northd/inc-proc-northd.c
+++ b/northd/inc-proc-northd.c
@@ -64,7 +64,8 @@ VLOG_DEFINE_THIS_MODULE(inc_proc_northd);
 NB_NODE(ha_chassis_group, "ha_chassis_group") \
 NB_NODE(ha_chassis, "ha_chassis") \
 NB_NODE(bfd, "bfd") \
-NB_NODE(static_mac_binding, "static_mac_binding")
+NB_NODE(static_mac_binding, "static_mac_binding") \
+NB_NODE(chassis_template_var, "chassis_template_var")
 
 enum nb_engine_node {
 #define NB_NODE(NAME, NAME_STR) NB_##NAME,
@@ -114,7 +115,8 @@ VLOG_DEFINE_THIS_MODULE(inc_proc_northd);
 SB_NODE(load_balancer, "load_balancer") \
 SB_NODE(bfd, "bfd") \
 SB_NODE(fdb, "fdb") \
-SB_NODE(static_mac_binding, "static_mac_binding")
+SB_NODE(static_mac_binding, "static_mac_binding") \
+SB_NODE(chassis_template_var, "chassis_template_var")
 
 enum sb_engine_node {
 #define SB_NODE(NAME, NAME_STR) SB_##NAME,
@@ -186,6 +188,7 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
 engine_add_input(_northd, _nb_ha_chassis_group, NULL);
 engine_add_input(_northd, _nb_ha_chassis, NULL);
 engine_add_input(_northd, _nb_static_mac_binding, NULL);
+engine_add_input(_northd, _nb_chassis_template_var, NULL);
 
 engine_add_input(_northd, _sb_sb_global, NULL);
 engine_add_input(_northd, _sb_chassis, NULL);
@@ -215,6 +218,7 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
 engine_add_input(_northd, _sb_load_balancer, NULL);
 engine_add_input(_northd, _sb_fdb, NULL);
 engine_add_input(_northd, _sb_static_mac_binding, NULL);
+engine_add_input(_northd, _sb_chassis_template_var, NULL);
 engine_add_input(_mac_binding_aging, _nb_nb_global, NULL);
 engine_add_input(_mac_binding_aging, _sb_mac_binding, NULL);
 engine_add_input(_mac_binding_aging, _northd, NULL);
diff --git a/northd/northd.c b/northd/northd.c
index b7388afc58..170b4f95c8 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -51,6 +51,7 @@
 #include "lib/stopwatch-names.h"
 #include "stream.h"
 #include "timeval.h"
+#include "template-var.h"
 #include "util.h"
 #include "uuid.h"
 #include "ovs-thread.h"
@@