@@ -452,11 +452,23 @@ func Test_openconfig_subintf_ipv6(t *testing.T) {
452452 t .Run ("Test Get/Verify Patch IPv6 address at subinterfaces addresses" , processGetRequest (url , nil , expected_get_json , false ))
453453 time .Sleep (1 * time .Second )
454454
455+ pre_req_map = map [string ]interface {}{"INTF_TABLE" : map [string ]interface {}{"Ethernet0:a::e/64" : map [string ]interface {}{"NULL" : "NULL" }}}
456+ loadDB (db .ApplDB , pre_req_map )
457+
458+ t .Log ("\n \n --- Verify PATCH IPv6 address at addresses address level ---" )
459+ url = "/openconfig-interfaces:interfaces/interface[name=Ethernet0]/subinterfaces/subinterface[index=0]/openconfig-if-ip:ipv6/addresses/address[ip=a::e]"
460+ expected_get_json = "{\" openconfig-if-ip:address\" :[{\" config\" :{\" ip\" :\" a::e\" ,\" prefix-length\" :64},\" ip\" :\" a::e\" , \" state\" :{\" ip\" :\" a::e\" ,\" prefix-length\" :64}}]}"
461+ t .Run ("Test Get/Verify Patch IPv6 address at subinterfaces addresses address" , processGetRequest (url , nil , expected_get_json , false ))
462+ time .Sleep (1 * time .Second )
463+
455464 t .Log ("\n \n --- Delete IPv6 address at subinterfaces addresses level---" )
456465 url = "/openconfig-interfaces:interfaces/interface[name=Ethernet0]/subinterfaces/subinterface[index=0]/openconfig-if-ip:ipv6/addresses"
457466 t .Run ("Test Delete IPv6 address at subinterfaces addresses level" , processDeleteRequest (url , true ))
458467 time .Sleep (1 * time .Second )
459468
469+ cleanuptbl = map [string ]interface {}{"INTF_TABLE" : map [string ]interface {}{"Ethernet0:a::e/64" : "" }}
470+ unloadDB (db .ApplDB , cleanuptbl )
471+
460472 t .Log ("\n \n --- Verify Delete IPv6 address at subinterfaces addresses ---" )
461473 url = "/openconfig-interfaces:interfaces/interface[name=Ethernet0]/subinterfaces/subinterface[index=0]/ipv6/addresses"
462474 expected_get_json = "{}"
@@ -498,8 +510,53 @@ func Test_openconfig_subintf_ipv6(t *testing.T) {
498510 t .Run ("Test Get IPv6 address at subinterfaces" , processGetRequest (url , nil , expected_get_json , false ))
499511 time .Sleep (1 * time .Second )
500512
513+ //-------------------------------------------------------------------------------------------------------------------------------------------
514+ t .Log ("\n \n --- PATCH IPv6 address at addresses ---" )
515+ url = "/openconfig-interfaces:interfaces/interface[name=Ethernet4]/subinterfaces/subinterface[index=0]/openconfig-if-ip:ipv6/addresses"
516+ url_input_body_json = "{\" openconfig-if-ip:addresses\" : {\" address\" : [{\" ip\" : \" 2001:0db8:abcd:0016::1\" , \" openconfig-if-ip:config\" : {\" ip\" : \" 2001:0db8:abcd:0016::1\" , \" prefix-length\" : 64}}]}}"
517+
518+ time .Sleep (1 * time .Second )
519+ t .Run ("Test Patch/Set IPv6 address on subinterfaces addresses" , processSetRequest (url , url_input_body_json , "PATCH" , false , nil ))
520+ time .Sleep (1 * time .Second )
521+
522+ t .Log ("\n \n --- Verify PATCH IPv6 address at addresses level ---" )
523+ url = "/openconfig-interfaces:interfaces/interface[name=Ethernet4]/subinterfaces/subinterface[index=0]/openconfig-if-ip:ipv6/addresses"
524+ expected_get_json = "{\" openconfig-if-ip:addresses\" :{\" address\" :[{\" config\" :{\" ip\" :\" 2001:db8:abcd:16::1\" ,\" prefix-length\" :64},\" ip\" :\" 2001:db8:abcd:16::1\" }]}}"
525+ t .Run ("Test Get/Verify Patch IPv6 address at subinterfaces addresses" , processGetRequest (url , nil , expected_get_json , false ))
526+ time .Sleep (1 * time .Second )
527+
528+ pre_req_map = map [string ]interface {}{"INTF_TABLE" : map [string ]interface {}{"Ethernet4:2001:db8:abcd:16::1/64" : map [string ]interface {}{"NULL" : "NULL" }}}
529+ loadDB (db .ApplDB , pre_req_map )
530+
531+ t .Log ("\n \n --- Verify PATCH IPv6 address at addresses address level ---" )
532+ url = "/openconfig-interfaces:interfaces/interface[name=Ethernet4]/subinterfaces/subinterface[index=0]/openconfig-if-ip:ipv6/addresses/address[ip=2001:db8:abcd:16::1]"
533+ expected_get_json = "{\" openconfig-if-ip:address\" :[{\" config\" :{\" ip\" :\" 2001:db8:abcd:16::1\" ,\" prefix-length\" :64},\" ip\" :\" 2001:db8:abcd:16::1\" , \" state\" :{\" ip\" :\" 2001:db8:abcd:16::1\" ,\" prefix-length\" :64}}]}"
534+ t .Run ("Test Get/Verify Patch IPv6 address at subinterfaces addresses address" , processGetRequest (url , nil , expected_get_json , false ))
535+ time .Sleep (1 * time .Second )
536+
537+ t .Log ("\n \n -Verify Db for iPv6 PATCH--\n \n " )
538+ url = "/openconfig-interfaces:interfaces/interface[name=Ethernet4]/subinterfaces/subinterface[index=0]/openconfig-if-ip:ipv6/addresses/address[ip=2001:db8:abcd:16::1]"
539+ expected_map := map [string ]interface {}{"INTERFACE" : map [string ]interface {}{"Ethernet4" : map [string ]interface {}{"family" : "IPv6" }}}
540+ t .Run ("Verify Db for IPv6 PATCH" , verifyDbResult (rclient , "INTERFACE|Ethernet4|2001:db8:abcd:16::1/64" , expected_map , false ))
541+
542+ t .Log ("\n \n --- Delete IPv6 address at subinterfaces addresses level---" )
543+ url = "/openconfig-interfaces:interfaces/interface[name=Ethernet4]/subinterfaces/subinterface[index=0]/openconfig-if-ip:ipv6/addresses"
544+ t .Run ("Test Delete IPv6 address at subinterfaces addresses level" , processDeleteRequest (url , false ))
545+ time .Sleep (1 * time .Second )
546+
547+ cleanuptbl = map [string ]interface {}{"INTF_TABLE" : map [string ]interface {}{"Ethernet4:2001:db8:abcd:16::1/64" : "" }}
548+ unloadDB (db .ApplDB , cleanuptbl )
549+
550+ t .Log ("\n \n --- Verify Delete IPv6 address at subinterfaces addresses ---" )
551+ url = "/openconfig-interfaces:interfaces/interface[name=Ethernet4]/subinterfaces/subinterface[index=0]/ipv6/addresses"
552+ expected_get_json = "{}"
553+ t .Run ("Test Get/Verify Delete IPv6 address at subinterfaces addresses" , processGetRequest (url , nil , expected_get_json , false ))
554+ time .Sleep (1 * time .Second )
555+
501556 t .Log ("\n \n +++++++++++++ DONE CONFIGURING AND REMOVING IPV6 ADDRESSES ON SUBINTERFACES ++++++++++++" )
502557
558+
559+ //------------------------------------------------------------------------------------------------------
503560 t .Log ("\n \n +++++++++++++ ENABLE AND DISABLE IPV6 LINK LOCAL ON SUBINTERFACES ++++++++++++" )
504561 t .Log ("\n \n --- Get IPv6 link local value (enabled) at config level ---" )
505562 url = "/openconfig-interfaces:interfaces/interface[name=Ethernet0]/subinterfaces/subinterface[index=0]/ipv6/config"
0 commit comments