Fix not supporting charset=utf8 in accept header value in the Rocky version

Change-Id: I75fa747b0b3014bfdb0f527a483378ebe273d286
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackSyncStateCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackSyncStateCommand.java
index f7495d6..8be5709 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackSyncStateCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackSyncStateCommand.java
@@ -33,7 +33,9 @@
 import org.openstack4j.model.network.Router;
 import org.openstack4j.model.network.Subnet;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -59,6 +61,9 @@
     private static final String DEVICE_OWNER_GW = "network:router_gateway";
     private static final String DEVICE_OWNER_IFACE = "network:router_interface";
 
+    private static final String HTTP_HEADER_ACCEPT = "accept";
+    private static final String HTTP_HEADER_VALUE_JSON = "application/json";
+
     @Override
     protected void doExecute() {
         OpenstackSecurityGroupAdminService osSgAdminService = get(OpenstackSecurityGroupAdminService.class);
@@ -66,6 +71,9 @@
         OpenstackRouterAdminService osRouterAdminService = get(OpenstackRouterAdminService.class);
         OpenstackNodeService osNodeService = get(OpenstackNodeService.class);
 
+        Map<String, String> headerMap = new HashMap();
+        headerMap.put(HTTP_HEADER_ACCEPT, HTTP_HEADER_VALUE_JSON);
+
         Optional<OpenstackNode> node = osNodeService.nodes(CONTROLLER).stream().findFirst();
         if (!node.isPresent()) {
             error("Keystone auth info has not been configured. " +
@@ -81,7 +89,7 @@
 
         print("Synchronizing OpenStack security groups");
         print(SECURITY_GROUP_FORMAT, "ID", "Name");
-        osClient.networking().securitygroup().list().forEach(osSg -> {
+        osClient.headers(headerMap).networking().securitygroup().list().forEach(osSg -> {
             if (osSgAdminService.securityGroup(osSg.getId()) != null) {
                 osSgAdminService.updateSecurityGroup(osSg);
             } else {
@@ -90,9 +98,10 @@
             print(SECURITY_GROUP_FORMAT, osSg.getId(), osSg.getName());
         });
 
+
         print("\nSynchronizing OpenStack networks");
         print(NETWORK_FORMAT, "ID", "Name", "VNI", "Subnets");
-        osClient.networking().network().list().forEach(osNet -> {
+        osClient.headers(headerMap).networking().network().list().forEach(osNet -> {
             if (osNetAdminService.network(osNet.getId()) != null) {
                 osNetAdminService.updateNetwork(osNet);
             } else {
@@ -101,9 +110,10 @@
             printNetwork(osNet);
         });
 
+
         print("\nSynchronizing OpenStack subnets");
         print(SUBNET_FORMAT, "ID", "Network", "CIDR");
-        osClient.networking().subnet().list().forEach(osSubnet -> {
+        osClient.headers(headerMap).networking().subnet().list().forEach(osSubnet -> {
             if (osNetAdminService.subnet(osSubnet.getId()) != null) {
                 osNetAdminService.updateSubnet(osSubnet);
             } else {
@@ -114,7 +124,7 @@
 
         print("\nSynchronizing OpenStack ports");
         print(PORT_FORMAT, "ID", "Network", "MAC", "Fixed IPs");
-        osClient.networking().port().list().forEach(osPort -> {
+        osClient.headers(headerMap).networking().port().list().forEach(osPort -> {
             if (osNetAdminService.port(osPort.getId()) != null) {
                 osNetAdminService.updatePort(osPort);
             } else {
@@ -125,7 +135,7 @@
 
         print("\nSynchronizing OpenStack routers");
         print(ROUTER_FORMAT, "ID", "Name", "External", "Internal");
-        osClient.networking().router().list().forEach(osRouter -> {
+        osClient.headers(headerMap).networking().router().list().forEach(osRouter -> {
             if (osRouterAdminService.router(osRouter.getId()) != null) {
                 osRouterAdminService.updateRouter(osRouter);
             } else {
@@ -143,7 +153,7 @@
 
         print("\nSynchronizing OpenStack floating IPs");
         print(FLOATING_IP_FORMAT, "ID", "Floating IP", "Fixed IP");
-        osClient.networking().floatingip().list().forEach(osFloating -> {
+        osClient.headers(headerMap).networking().floatingip().list().forEach(osFloating -> {
             if (osRouterAdminService.floatingIp(osFloating.getId()) != null) {
                 osRouterAdminService.updateFloatingIp(osFloating);
             } else {
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/web/OpenstackManagementWebResource.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/web/OpenstackManagementWebResource.java
index 94470eb..2c36b2e 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/web/OpenstackManagementWebResource.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/web/OpenstackManagementWebResource.java
@@ -48,7 +48,9 @@
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 
@@ -81,6 +83,9 @@
 
     private static final String SECURITY_GROUP_FLAG_REQUIRED = "Security Group flag is not specified";
 
+    private static final String HTTP_HEADER_ACCEPT = "accept";
+    private static final String HTTP_HEADER_VALUE_JSON = "application/json";
+
     private final ObjectNode root = mapper().createObjectNode();
     private final ArrayNode floatingipsNode = root.putArray(FLOATINGIPS);
 
@@ -105,6 +110,9 @@
     @Path("sync/states")
     public Response syncStates() {
 
+        Map<String, String> headerMap = new HashMap();
+        headerMap.put(HTTP_HEADER_ACCEPT, HTTP_HEADER_VALUE_JSON);
+
         Optional<OpenstackNode> node = osNodeAdminService.nodes(CONTROLLER).stream().findFirst();
         if (!node.isPresent()) {
             throw new ItemNotFoundException("Auth info is not found");
@@ -116,7 +124,7 @@
             throw new ItemNotFoundException("Auth info is not correct");
         }
 
-        osClient.networking().securitygroup().list().forEach(osSg -> {
+        osClient.headers(headerMap).networking().securitygroup().list().forEach(osSg -> {
             if (osSgAdminService.securityGroup(osSg.getId()) != null) {
                 osSgAdminService.updateSecurityGroup(osSg);
             } else {
@@ -124,7 +132,7 @@
             }
         });
 
-        osClient.networking().network().list().forEach(osNet -> {
+        osClient.headers(headerMap).networking().network().list().forEach(osNet -> {
             if (osNetAdminService.network(osNet.getId()) != null) {
                 osNetAdminService.updateNetwork(osNet);
             } else {
@@ -132,7 +140,7 @@
             }
         });
 
-        osClient.networking().subnet().list().forEach(osSubnet -> {
+        osClient.headers(headerMap).networking().subnet().list().forEach(osSubnet -> {
             if (osNetAdminService.subnet(osSubnet.getId()) != null) {
                 osNetAdminService.updateSubnet(osSubnet);
             } else {
@@ -140,7 +148,7 @@
             }
         });
 
-        osClient.networking().port().list().forEach(osPort -> {
+        osClient.headers(headerMap).networking().port().list().forEach(osPort -> {
             if (osNetAdminService.port(osPort.getId()) != null) {
                 osNetAdminService.updatePort(osPort);
             } else {
@@ -148,7 +156,7 @@
             }
         });
 
-        osClient.networking().router().list().forEach(osRouter -> {
+        osClient.headers(headerMap).networking().router().list().forEach(osRouter -> {
             if (osRouterAdminService.router(osRouter.getId()) != null) {
                 osRouterAdminService.updateRouter(osRouter);
             } else {
@@ -161,7 +169,7 @@
                     .forEach(osPort -> addRouterIface(osPort, osRouterAdminService));
         });
 
-        osClient.networking().floatingip().list().forEach(osFloating -> {
+        osClient.headers(headerMap).networking().floatingip().list().forEach(osFloating -> {
             if (osRouterAdminService.floatingIp(osFloating.getId()) != null) {
                 osRouterAdminService.updateFloatingIp(osFloating);
             } else {