Documentation
¶
Index ¶
- Variables
- func CompareBinary(imcPath string, vspPath string, client *ssh.Client) (bool, string)
- func CompareFile(inputFile string, remoteFilePath string, client *ssh.Client) (bool, string)
- func CopyBinary(imcPath string, vspPath string, sftpClient *sftp.Client) error
- func CopyFile(inputFile string, remoteFilePath string, sftpClient *sftp.Client) error
- func ExecOsCommand(cmdBin string, params ...string) error
- func ExecuteScript(script string) (string, error)
- func ExtractVsiVportInfo(macAddr string) (int, int, error)
- func GetAccApfMacList() ([]string, error)
- func GetAvailableAccVsiList() ([]string, error)
- func GetMacAsByteArray(macAddr string) ([]byte, error)
- func GetMacIntValueFromBytes(macAddr []byte) uint64
- func GetVfMacList() ([]string, error)
- func GetVportForVsi(vsi int) int
- func GetVsiVportInfo(macAddr string) (int, int, error)
- func ImcQueryfindVsiGivenMacAddr(mode string, mac string) (string, error)
- func RestoreRHPrimaryNetwork()
- func RunCliCmdOnImc(cliCmd, subCmd string) ([]byte, error)
- func RunP4rtCtlCommand(p4rtBin string, p4rtIpPort string, params ...string) (string, string, error)
- func VerifiedFilePath(fileName string, allowedDir string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var P4rtMutex sync.Mutex
Functions ¶
func CompareBinary ¶
compares(using md5sum) binary on IMC, with equivalent binary built-into ipu-plugin(VSP) image. returns true, if binary checksum matches, false otherwise.
func CompareFile ¶
compares(using md5sum) file on IMC, with equivalent file-content(in string format) as expected by ipu-plugin(VSP). returns true, if file checksum matches, false otherwise.
func CopyBinary ¶
copies binary part of ipu-plugin(VSP) image onto IMC(to the path provided)
func ExecOsCommand ¶
func ExecuteScript ¶
func GetAccApfMacList ¶
func GetAvailableAccVsiList ¶
skips ACC interfaces D0 to D3, which are used internally. So, not available for other usages. $2 == 4 is to get ACC entries, and $10 check is to make sure, we skip rows that has vportIDs from D0 to D3.
func GetMacAsByteArray ¶
func GetMacIntValueFromBytes ¶
func GetVfMacList ¶
func GetVportForVsi ¶
func RestoreRHPrimaryNetwork ¶
func RestoreRHPrimaryNetwork()
func RunCliCmdOnImc ¶
Note: Added retry logic, since ipumgmtd is single-threaded, so concurrent usage, of cli-client errors out. we retry 5 times, with sleep(0.5s) between retries. If it exceeds max attempts, we quit retry. retry logic is a best-effort attempt. WARNING: Even if ipumgmtd throws error, cli_client tool still returns success. Also this code(for retry) can break, if error string or error code gets changed.
func RunP4rtCtlCommand ¶
func VerifiedFilePath ¶
Taken from the IPDK k8s-infra-offload project instead of including the full project as a module https://github.com/ipdk-io/k8s-infra-offload/blob/30f0efb483d177df7ce052d014593c1a17def8bc/pkg/utils/utils.go#L659
VerifiedFilePath validates a file for potential file path traversal attacks. It returns the real filepath after cleaning and evaluiating any symlinks in the path. It returns error if the "fileName" is not within the "allowedDir", point to a non-privileged location or "fileName" points to a file outside of allowed dir.
Types ¶
This section is empty.