public static void addRouterIface(Port osPort,
                                      OpenstackRouterAdminService adminService) {
        osPort.getFixedIps().forEach(p -> {
            JsonNode jsonTree = new ObjectMapper().createObjectNode()
                    .put("id", osPort.getDeviceId())
                    .put("tenant_id", osPort.getTenantId())
                    .put("subnet_id", p.getSubnetId())
                    .put("port_id", osPort.getId());
            try {
                RouterInterface rIface = getContext(NeutronRouterInterface.class)
                        .readerFor(NeutronRouterInterface.class)
                        .readValue(jsonTree);
                if (adminService.routerInterface(rIface.getPortId()) != null) {
                    adminService.updateRouterInterface(rIface);
                } else {
                    adminService.addRouterInterface(rIface);
                }
            } catch (IOException e) {
                log.error("IOException occurred because of {}", e);
            }
        });
    }
@Test
    public void testAddRouterIface() {
        OpenstackRouterAdminService service = new TestOpenstackRouterAdminService();

        addRouterIface(openstackPort, service);
        RouterInterface initialRouterInterface = new TestRouterInterface(openstackPort.getDeviceId(),
                openstackPort.getFixedIps().stream().findAny().get().getSubnetId(),
                openstackPort.getId(),
                openstackPort.getTenantId());

        assertTrue(routerInterfacesEquals(initialRouterInterface, service.routerInterface(openstackPort.getId())));

        addRouterIface(openstackSriovPort1, service);
        RouterInterface updatedInitialRouterInterface = new TestRouterInterface(openstackSriovPort1.getDeviceId(),
                openstackSriovPort1.getFixedIps().stream().findAny().get().getSubnetId(),
                openstackSriovPort1.getId(),
                openstackSriovPort1.getTenantId());

        assertTrue(routerInterfacesEquals(
                updatedInitialRouterInterface, service.routerInterface(openstackSriovPort1.getId())));
    }