@@ -2925,45 +2925,6 @@ namespace portsorch_test
29252925 }
29262926 }
29272927
2928- TEST_F (PortsOrchTest, PortHostIfCreateFailed)
2929- {
2930- Table portTable = Table (m_app_db.get (), APP_PORT_TABLE_NAME);
2931-
2932- auto original_api = sai_hostif_api->create_hostif ;
2933- auto hostIfSpy = SpyOn<SAI_API_HOSTIF, SAI_OBJECT_TYPE_HOSTIF>(&sai_hostif_api->create_hostif );
2934- hostIfSpy->callFake ([&](sai_object_id_t *, sai_object_id_t , uint32_t , const sai_attribute_t *) -> sai_status_t {
2935- return SAI_STATUS_INSUFFICIENT_RESOURCES;
2936- }
2937- );
2938-
2939- // Get SAI default ports to populate DB
2940-
2941- auto ports = ut_helper::getInitialSaiPorts ();
2942-
2943- // Populate pot table with SAI ports
2944- for (const auto &it : ports)
2945- {
2946- portTable.set (it.first , it.second );
2947- }
2948-
2949- // Set PortConfigDone
2950- portTable.set (" PortConfigDone" , { { " count" , to_string (ports.size ()) } });
2951-
2952- gPortsOrch ->addExistingData (&portTable);
2953-
2954- // Apply configuration :
2955- // create ports
2956-
2957- static_cast <Orch *>(gPortsOrch )->doTask ();
2958-
2959- sai_hostif_api->create_hostif = original_api;
2960-
2961- Port port;
2962- gPortsOrch ->getPort (" Ethernet0" , port);
2963-
2964- ASSERT_FALSE (port.m_init );
2965- }
2966-
29672928 TEST_F (PortsOrchTest, PortsWithNoPGsQueuesSchedulerGroups)
29682929 {
29692930 Table portTable = Table (m_app_db.get (), APP_PORT_TABLE_NAME);
@@ -3976,4 +3937,48 @@ namespace portsorch_test
39763937 stateDbSet = stateTable.hget (" Ethernet0" , " max_priority_groups" , value);
39773938 ASSERT_TRUE (stateDbSet);
39783939 }
3940+
3941+ struct PortsOrchNegativeTests : PortsOrchTest
3942+ {
3943+ };
3944+
3945+ TEST_F (PortsOrchNegativeTests, PortHostIfCreateFailed)
3946+ {
3947+ Table portTable = Table (m_app_db.get (), APP_PORT_TABLE_NAME);
3948+
3949+ auto original_api = sai_hostif_api->create_hostif ;
3950+ auto hostIfSpy = SpyOn<SAI_API_HOSTIF, SAI_OBJECT_TYPE_HOSTIF>(&sai_hostif_api->create_hostif );
3951+ hostIfSpy->callFake ([&](sai_object_id_t *, sai_object_id_t , uint32_t , const sai_attribute_t *) -> sai_status_t {
3952+ return SAI_STATUS_INSUFFICIENT_RESOURCES;
3953+ }
3954+ );
3955+
3956+ // Get SAI default ports to populate DB
3957+
3958+ auto ports = ut_helper::getInitialSaiPorts ();
3959+
3960+ // Populate pot table with SAI ports
3961+ for (const auto &it : ports)
3962+ {
3963+ portTable.set (it.first , it.second );
3964+ }
3965+
3966+ // Set PortConfigDone
3967+ portTable.set (" PortConfigDone" , { { " count" , to_string (ports.size ()) } });
3968+
3969+ gPortsOrch ->addExistingData (&portTable);
3970+
3971+ // Apply configuration :
3972+ // create ports
3973+
3974+ static_cast <Orch *>(gPortsOrch )->doTask ();
3975+
3976+ sai_hostif_api->create_hostif = original_api;
3977+
3978+ Port port;
3979+ gPortsOrch ->getPort (" Ethernet0" , port);
3980+
3981+ ASSERT_FALSE (port.m_init );
3982+ }
3983+
39793984}
0 commit comments