Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-SMF
Commits
2febba0a
Commit
2febba0a
authored
Aug 03, 2021
by
Niuhaiwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some bug about data format and ip address
parent
c5f54b5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
10 deletions
+35
-10
src/minimal-ws-server/minimal-ws-server.c
src/minimal-ws-server/minimal-ws-server.c
+1
-1
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+34
-9
No files found.
src/minimal-ws-server/minimal-ws-server.c
View file @
2febba0a
...
@@ -224,7 +224,7 @@ void *http_server_thread_fn(void *arg)
...
@@ -224,7 +224,7 @@ void *http_server_thread_fn(void *arg)
struct
event_base
*
base
=
NULL
;
struct
event_base
*
base
=
NULL
;
struct
evhttp
*
http_server
=
NULL
;
struct
evhttp
*
http_server
=
NULL
;
char
*
http_addr
=
"192.168.199.
235
"
;
char
*
http_addr
=
"192.168.199.
50
"
;
int
http_port
=
8081
;
int
http_port
=
8081
;
/* Initialize the event library */
/* Initialize the event library */
...
...
src/smf_app/smf_app.cpp
View file @
2febba0a
...
@@ -1326,7 +1326,7 @@ bool smf_app::handle_nf_status_notification(
...
@@ -1326,7 +1326,7 @@ bool smf_app::handle_nf_status_notification(
strftime
(
buffer
,
80
,
"%Y-%m-%d %H:%M:%S"
,
info
);
strftime
(
buffer
,
80
,
"%Y-%m-%d %H:%M:%S"
,
info
);
json_data
[
"time"
]
=
buffer
;
json_data
[
"time"
]
=
buffer
;
my_json
json_data_arr
=
nlohmann
::
json
::
array
();
my_json
json_data_arr
=
nlohmann
::
json
::
array
();
json_data_arr
.
push_back
(
json_data
);
//
json_data_arr.push_back(json_data);
int
number
=
0
;
int
number
=
0
;
for
(
int
i
=
0
;
i
<=
nf_num
;
i
++
)
for
(
int
i
=
0
;
i
<=
nf_num
;
i
++
)
{
{
...
@@ -1343,12 +1343,37 @@ bool smf_app::handle_nf_status_notification(
...
@@ -1343,12 +1343,37 @@ bool smf_app::handle_nf_status_notification(
if
(
nf_status_json_arr
[
i
][
"nfType"
].
dump
().
compare
(
json_data
[
"nfType"
].
dump
().
c_str
())
==
0
)
if
(
nf_status_json_arr
[
i
][
"nfType"
].
dump
().
compare
(
json_data
[
"nfType"
].
dump
().
c_str
())
==
0
)
{
{
Logger
::
smf_app
().
error
(
"the nftype is exist"
);
Logger
::
smf_app
().
error
(
"the nftype is exist"
);
nf_status_json_arr
[
i
][
"nfInstanceName"
]
=
json_data
[
"nfInstanceName"
];
if
(
nf_status_json_arr
[
i
][
"nfInstanceId"
].
dump
().
compare
(
json_data
[
"nfInstanceId"
].
dump
().
c_str
())
==
0
)
nf_status_json_arr
[
i
][
"nfEvent"
]
=
json_data
[
"nfEvent"
];
{
nf_status_json_arr
[
i
][
"nfStatus"
]
=
json_data
[
"nfStatus"
];
nf_status_json_arr
[
i
][
"nfInstanceName"
]
=
json_data
[
"nfInstanceName"
];
nf_status_json_arr
[
i
][
"nfInstanceId"
]
=
json_data
[
"nfInstanceId"
];
nf_status_json_arr
[
i
][
"nfEvent"
]
=
json_data
[
"nfEvent"
];
nf_status_json_arr
[
i
][
"ipv4Addresses"
]
=
json_data
[
"ipv4Addresses"
];
nf_status_json_arr
[
i
][
"nfStatus"
]
=
json_data
[
"nfStatus"
];
nf_status_json_arr
[
i
][
"time"
]
=
json_data
[
"time"
];
nf_status_json_arr
[
i
][
"nfInstanceId"
]
=
json_data
[
"nfInstanceId"
];
nf_status_json_arr
[
i
][
"ipv4Addresses"
]
=
json_data
[
"ipv4Addresses"
];
nf_status_json_arr
[
i
][
"time"
]
=
json_data
[
"time"
];
printf
(
"the Instance ID same
\n
"
);
}
//printf("the json nfEvent is %s\n",json_data["nfEvent"].dump().c_str());
else
{
printf
(
"the json nfEvent is %s
\n
"
,
json_data
[
"nfEvent"
].
dump
().
c_str
());
if
(
strstr
(
json_data
[
"nfEvent"
].
dump
().
c_str
(),
"NF_DEREGISTERED"
)
==
NULL
)
{
nf_status_json_arr
[
i
][
"nfInstanceName"
]
=
json_data
[
"nfInstanceName"
];
nf_status_json_arr
[
i
][
"nfEvent"
]
=
json_data
[
"nfEvent"
];
nf_status_json_arr
[
i
][
"nfStatus"
]
=
json_data
[
"nfStatus"
];
nf_status_json_arr
[
i
][
"nfInstanceId"
]
=
json_data
[
"nfInstanceId"
];
nf_status_json_arr
[
i
][
"ipv4Addresses"
]
=
json_data
[
"ipv4Addresses"
];
nf_status_json_arr
[
i
][
"time"
]
=
json_data
[
"time"
];
printf
(
"the Instance ID different
\n
"
);
}
}
json_data
[
"nfInstanceName"
]
=
nf_status_json_arr
[
i
][
"nfInstanceName"
];
json_data
[
"nfEvent"
]
=
nf_status_json_arr
[
i
][
"nfEvent"
];
json_data
[
"nfStatus"
]
=
nf_status_json_arr
[
i
][
"nfStatus"
];
json_data
[
"nfInstanceId"
]
=
nf_status_json_arr
[
i
][
"nfInstanceId"
];
json_data
[
"ipv4Addresses"
]
=
nf_status_json_arr
[
i
][
"ipv4Addresses"
];
json_data
[
"time"
]
=
nf_status_json_arr
[
i
][
"time"
];
}
}
else
else
{
{
...
@@ -1365,11 +1390,11 @@ bool smf_app::handle_nf_status_notification(
...
@@ -1365,11 +1390,11 @@ bool smf_app::handle_nf_status_notification(
" nf_status_json_arr [%d] %s
\n
"
,
i
,
" nf_status_json_arr [%d] %s
\n
"
,
i
,
nf_status_json_arr
[
i
].
dump
().
c_str
());
nf_status_json_arr
[
i
].
dump
().
c_str
());
}
}
json_data_arr
.
push_back
(
json_data
);
Logger
::
smf_app
().
error
(
"nf_num %d"
,
nf_num
);
Logger
::
smf_app
().
error
(
"nf_num %d"
,
nf_num
);
//nf_status_json_arr.push_back(json_data);
//nf_status_json_arr.push_back(json_data);
nf_status_arr_len
=
nf_status_json_arr
.
dump
().
length
();
nf_status_arr_len
=
nf_status_json_arr
.
dump
().
length
();
Logger
::
smf_app
().
error
(
//Logger::smf_app().error("nf_status_json_data %s \n",nf_status_json_arr.dump().c_str());
"nf_status_json_data %s
\n
"
,
nf_status_json_arr
.
dump
().
c_str
());
memset
(
nf_status_arr
,
'\0'
,
1000
);
memset
(
nf_status_arr
,
'\0'
,
1000
);
memcpy
(
nf_status_arr
,
nf_status_json_arr
.
dump
().
c_str
(),
nf_status_arr_len
);
memcpy
(
nf_status_arr
,
nf_status_json_arr
.
dump
().
c_str
(),
nf_status_arr_len
);
Logger
::
smf_app
().
error
(
Logger
::
smf_app
().
error
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment