Skip to content

Commit

Permalink
feat: deepflow-ctl tool adds request parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
lzf575 committed Jan 1, 2025
1 parent 986f3f2 commit d2da91f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions cli/ctl/trisolaris_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ type ParamData struct {
RpcIP string
RpcPort string
Type string
PlatformDataVersion uint64
GroupsVersion uint64
ProcessName string
PluginType string
PluginName string
}
Expand Down Expand Up @@ -233,6 +236,9 @@ func RegisterTrisolarisCommand() *cobra.Command {
trisolarisCmd.PersistentFlags().StringVarP(&paramData.Type, "type", "", "trident", "request type trdient/analyzer")
trisolarisCmd.PersistentFlags().StringVarP(&paramData.PluginType, "ptype", "", "wasm", "request plugin type")
trisolarisCmd.PersistentFlags().StringVarP(&paramData.PluginName, "pname", "", "", "request plugin name")
trisolarisCmd.PersistentFlags().Uint64VarP(&paramData.PlatformDataVersion, "pver", "", 0, "platform-data version")
trisolarisCmd.PersistentFlags().Uint64VarP(&paramData.GroupsVersion, "gver", "", 0, "groups version")
trisolarisCmd.PersistentFlags().StringVarP(&paramData.ProcessName, "procname", "", "", "request process name")
cmds := regiterCommand()
for _, handler := range cmds {
trisolarisCmd.AddCommand(handler)
Expand Down Expand Up @@ -269,12 +275,18 @@ func initCmd(cmd *cobra.Command, cmds []CmdExecute) {
switch paramData.Type {
case "trident":
name = paramData.Type
if paramData.ProcessName != "" {
name = paramData.ProcessName
}
groupID = paramData.GroupID
clusterID = paramData.ClusterID
teamID = paramData.TeamID
orgID = paramData.OrgID
case "analyzer":
name = paramData.Type
if paramData.ProcessName != "" {
name = paramData.ProcessName
}
orgID = paramData.OrgID
default:
fmt.Printf("type(%s) muste be in [trident, analyzer]", paramData.Type)
Expand All @@ -283,6 +295,8 @@ func initCmd(cmd *cobra.Command, cmds []CmdExecute) {
fmt.Printf("request trisolaris(%s), params(%+v)\n", conn.Target(), paramData)
c := trident.NewSynchronizerClient(conn)
reqData := &trident.SyncRequest{
VersionPlatformData: proto.Uint64(paramData.PlatformDataVersion),
VersionGroups: proto.Uint64(paramData.GroupsVersion),
CtrlIp: &paramData.CtrlIP,
CtrlMac: &paramData.CtrlMac,
VtapGroupIdRequest: &groupID,
Expand Down
4 changes: 2 additions & 2 deletions server/libs/grpc/grpc_platformdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,8 @@ func (t *PlatformInfoTable) OrgString(orgId uint16) string {
sb := &strings.Builder{}

sb.WriteString(fmt.Sprintf("OrgID %d AnalyzerID %d RegionID:%d Drop Other RegionID Data Count:%d\n", orgId, t.analyzerID, t.regionID[orgId], t.otherRegionCount[orgId]))
sb.WriteString(fmt.Sprintf("moduleName:%s ctlIP:%s hostname:%s RegionID:%d\n",
t.moduleName, t.ctlIP, t.hostname, t.regionID[orgId]))
sb.WriteString(fmt.Sprintf("moduleName:%s ctlIP:%s hostname:%s RegionID:%d PlatformDataVersion:%d\n",
t.moduleName, t.ctlIP, t.hostname, t.regionID[orgId], t.versionPlatformData[orgId]))
sb.WriteString(fmt.Sprintf("ARCH:%s OS:%s Kernel:%s CPUNum:%d MemorySize:%d\n", t.runtimeEnv.Arch, t.runtimeEnv.OS, t.runtimeEnv.KernelVersion, t.runtimeEnv.CpuNum, t.runtimeEnv.MemorySize))
if len(t.epcIDIPV4Infos[orgId]) > 0 {
sb.WriteString("\n1 *epcID *ipv4 mac host hostID regionID deviceType deviceID subnetID podNodeID podNSID podGroupID podGroupType podID podClusterID azID isVip isWan vtapId hitCount (ipv4平台信息)\n")
Expand Down

0 comments on commit d2da91f

Please sign in to comment.