Skip to content

Commit

Permalink
Print charon log to terminal
Browse files Browse the repository at this point in the history
Signed-off-by: Xu Liu <xliu2@vmware.com>
  • Loading branch information
xliuxu committed Dec 19, 2022
1 parent 8c23549 commit 76bc543
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@

- name: Install containerd
apt:
name: containerd.io
name: containerd.io=1.6.12-1
state: present
update_cache: yes
allow_downgrades: yes
force_apt_get: yes
notify:
- containerd status
Expand Down
17 changes: 16 additions & 1 deletion test/e2e/ipsec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ func (data *TestData) readOVSIPsecTunnelStatus(nodeName string) (string, error)
return fmt.Sprintf("stdout:\n %sstderr:\n %s", stdout, stderr), err
}

func (data *TestData) readCharonLog(nodeName string) (string, error) {
antreaPodName, err := data.getAntreaPodOnNode(nodeName)
if err != nil {
return "", err
}
cmd := strings.Split("cat /var/log/strongswan/charon.log", " ")
stdout, _, err := data.RunCommandFromPod(antreaNamespace, antreaPodName, "antrea-ipsec", cmd)
return stdout, err
}

func (data *TestData) readSecurityAssociationsStatus(nodeName string) (up int, connecting int, isCertAuth bool, stdout string, err error) {
antreaPodName, err := data.getAntreaPodOnNode(nodeName)
if err != nil {
Expand Down Expand Up @@ -118,7 +128,6 @@ func (data *TestData) readSecurityAssociationsStatus(nodeName string) (up int, c
if len(match) == 0 {
return 0, 0, false, "", fmt.Errorf("failed to determine authentication method from 'ipsec statusall' output: %s", stdout)
}

if match[1] == "pre-shared" {
isCertAuth = false
} else if match[1] == "public" {
Expand Down Expand Up @@ -150,6 +159,12 @@ func testIPSecTunnelConnectivity(t *testing.T, data *TestData, certAuth bool) {
} else {
t.Logf("%s:\n%s", msg, tunnelStatus)
}
clog, err := data.readCharonLog(nodeName(0))
if err != nil {
t.Errorf("Failed to read charon log: %s", err)
} else {
t.Logf("charon log:\n%s", clog)
}
}
debugTunnelStatus("IPsec tunnel status before ping mesh")
defer debugTunnelStatus("IPsec tunnel status after ping mesh")
Expand Down

0 comments on commit 76bc543

Please sign in to comment.