go.ligato.io/vpp-agent/v3@v3.5.0/examples/kvscheduler/mock_plugins/scenario/pending_after_resync.go (about) 1 // Copyright (c) 2019 Cisco and/or its affiliates. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at: 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package scenario 16 17 import ( 18 "context" 19 "log" 20 21 "go.ligato.io/vpp-agent/v3/client" 22 ) 23 24 // PendingAfterResync presents a scenario, in which some objects are pending 25 // after the first resync since their dependencies are not satisfied. 26 // Then, with the next update transaction, the missing items are set to be 27 // configured together with all the associated objects that were waiting for 28 // them. 29 func PendingAfterResync() { 30 c := client.LocalClient 31 listKnownModels(c) 32 33 printMessage( 34 "Resync config", 35 " - TAP interface tap1 and single loopback are configured", 36 " - BD is configured to contain tap2 and the loopback, but not tap1", 37 " -> binding between tap2 and BD will be PENDING", 38 " - FIB entry fib1 is defined to forward traffic for a certain", 39 " MAC address via tap1", 40 " -> tap1 will get configured, but not inside the bridge", 41 " domain, therefore the FIB will remain pending", 42 " - FIB entry fib2 is defined to forward traffic for a certain", 43 " MAC address via tap2", 44 " -> tap2 is not configured, therefore the FIB will remain", 45 " pending", 46 ) 47 err := c.ResyncConfig( 48 tap1, loopback1, bd1WithoutTap1, fib1, fib2, 49 ) 50 if err != nil { 51 log.Println(err) 52 } 53 informAboutGraphURL(0, true, true) 54 55 printMessage( 56 "Change config", 57 " - bridge domain is edited to also contain tap1", 58 " -> first, tap1 will be put into the BD", 59 " -> as a consequence, fib1 becomes ready and gets configured", 60 " - tap2 interface is requested to be configured", 61 " -> the interface is configured first", 62 " -> next, the interface is put into the bridge domain", 63 " -> finally, the pending fib2 becomes ready and gets configured", 64 ) 65 66 req := c.ChangeRequest() 67 req.Update(bd1, tap2) 68 if err := req.Send(context.Background()); err != nil { 69 log.Println(err) 70 } 71 informAboutGraphURL(1, false, true) 72 }