-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send IPv4 GARP and IPv6 Unsolicited NA in "cmdAdd"
In "cmdAdd", SRIOV-CNI would construct and send IPv4 Gratuitous ARP and/or Unsolicited Neighbor Advertisement depending on the IP addresses configured by IPAM. The reason why this change is needed is for the scenario when an IP address is reused by IPAM with different interfaces (with different link-layer addresses). This can occur when pods are deleted and created. For performance reasons, sending of GARP and/or Unsolicited NA would update invalid ARP/Neighbor caches in other neighbors/nodes. Also we set IPv4 ARP Notify and IPv6 Neighbor Discovery Notify in sysfs for each interface. This will send GARP and/or Unsolicited NA when the interface is either brought up or the link-layer address changes. This is useful in cases where an application reenables the interface or the MAC address configuration is changed. Some new packages were added, thus go.mod and go.sum were modified accordingly. Mocked PciUtils for sriov tests since sriov.go would call PciUtils to set IPv4 ARP Notify and IPv6 Neighbor Discovery. Fixes #177 Signed-off-by: William Zhao <wizhao@redhat.com>
- Loading branch information
1 parent
921c28c
commit c241dcb
Showing
11 changed files
with
763 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Developer Readme | ||
|
||
* [Using Mockery](#using-mockery) | ||
|
||
## Using Mockery | ||
|
||
Mockery (https://github.com/vektra/mockery) is used to auto-generate mock files for golang interfaces. The advantage of using Mockery is that there will be no need to manually write boilerplate code for mocking interfaces. | ||
|
||
Reading the readme file in Mockery is recommended to understand how to get started with Mockery. | ||
|
||
For each package, there may be a "mocks" folder with mock files generated by Mockery. To generate the mock for a particular interface the following command format should be used at the root project directory: | ||
|
||
``` | ||
docker run -v "$PWD":/src -w /src vektra/mockery --recursive=true --name=<Interface Name> --output=./pkg/<Package name where the interface is defined>/mocks/ --filename=<Interface Name>_mock.go --exported | ||
``` | ||
|
||
An example for mocking the "pciUtils" interface in the "sriov" package is as follows: | ||
|
||
``` | ||
docker run -v "$PWD":/src -w /src vektra/mockery --recursive=true --name=pciUtils --output=./pkg/sriov/mocks/ --filename=pci_utils_mock.go --exported | ||
``` | ||
|
||
This will create the "mocks" directory if not present and will auto-generate the mock file "pci_utils_mock.go" for the "pciUtils" interface. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.