Beispiel #1
0
void
test_bridge_ofp_version(void) {
  uint8_t ver;
  lagopus_result_t rv;

  rv = bridge_ofp_version_get(bridge, &ver);
  TEST_ASSERT_EQUAL(rv, LAGOPUS_RESULT_OK);
  rv = bridge_ofp_version_set(bridge, 0);
  TEST_ASSERT_EQUAL(rv, LAGOPUS_RESULT_INVALID_ARGS);
  rv = bridge_ofp_version_set(bridge, OPENFLOW_VERSION_1_3);
  TEST_ASSERT_EQUAL(rv, LAGOPUS_RESULT_OK);
  rv = bridge_ofp_version_set(bridge, OPENFLOW_VERSION_1_4);
  TEST_ASSERT_EQUAL(rv, LAGOPUS_RESULT_OK);
}
Beispiel #2
0
lagopus_result_t
dpmgr_bridge_ofp_version_get(uint64_t dpid, uint8_t *version) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;
  struct dpmgr *dpmgr = NULL;
  struct bridge *bridge = NULL;

  dpmgr = dpmgr_get_instance();
  if (dpmgr != NULL) {
    bridge = bridge_lookup_by_dpid(&dpmgr->bridge_list, dpid);
    if (bridge != NULL) {
      ret = bridge_ofp_version_get(bridge, version);
    } else {
      lagopus_msg_warning("Not found bridge.\n");
      ret = LAGOPUS_RESULT_NOT_FOUND;
    }
  } else {
    lagopus_msg_warning("Not found dpmgr.\n");
    ret = LAGOPUS_RESULT_NOT_FOUND;
  }

  return ret;
}