@@ -840,8 +840,9 @@ json_parse_network_interface(json_t *network_interface, bbl_network_config_s *ne
840840 const char * schema [] = {
841841 "interface" , "address" , "gateway" ,
842842 "address-ipv6" , "gateway-ipv6" , "ipv6-router-advertisement" ,
843- "gateway-mac" , "vlan" , "mtu" , "gateway-resolve-wait" ,
844- "isis-instance-id" , "isis-level" , "isis-p2p" ,
843+ "gateway-mac" , "vlan" , "inner-vlan" , "qinq" , "mtu" ,
844+ "gateway-resolve-wait" ,
845+ "isis-instance-id" , "isis-level" , "isis-p2p" ,
845846 "isis-l1-metric" , "isis-l2-metric" ,
846847 "isis-l1-priority" , "isis-l2-priority" ,
847848 "ospfv2-instance-id" , "ospfv2-metric" , "ospfv2-type" ,
@@ -913,6 +914,23 @@ json_parse_network_interface(json_t *network_interface, bbl_network_config_s *ne
913914 network_config -> vlan = json_number_value (value );
914915 network_config -> vlan &= 4095 ;
915916 }
917+ JSON_OBJ_GET_NUMBER (network_interface , value , "access" , "inner-vlan" , 0 , 4095 );
918+ if (value ) {
919+ network_config -> inner_vlan = json_number_value (value );
920+ network_config -> inner_vlan &= 4095 ;
921+ if (network_config -> inner_vlan && network_config -> vlan == 0 ) {
922+ fprintf (stderr , "JSON config error: Network interface with inner-vlan but no vlan (outer)\n" );
923+ return false;
924+ }
925+ }
926+ JSON_OBJ_GET_BOOL (network_interface , value , "access" , "qinq" );
927+ if (value ) {
928+ network_config -> qinq = json_boolean_value (value );
929+ if (network_config -> qinq && network_config -> inner_vlan == 0 ) {
930+ fprintf (stderr , "JSON config error: Enabling qinq on network interfaces requires an inner-vlan\n" );
931+ return false;
932+ }
933+ }
916934 JSON_OBJ_GET_NUMBER (network_interface , value , "network" , "mtu" , 64 , 9000 );
917935 if (value ) {
918936 network_config -> mtu = json_number_value (value );
0 commit comments